@shopify/cli-kit 0.0.0-nightly-20230110194301
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 +8 -0
- package/README.md +63 -0
- package/assets/auth-error.html +23 -0
- package/assets/empty-url.html +23 -0
- package/assets/favicon.svg +26 -0
- package/assets/missing-code.html +23 -0
- package/assets/missing-state.html +23 -0
- package/assets/style.css +58 -0
- package/assets/success.html +20 -0
- package/dist/api/admin.d.ts +3 -0
- package/dist/api/admin.js +56 -0
- package/dist/api/admin.js.map +1 -0
- package/dist/api/common.d.ts +21 -0
- package/dist/api/common.js +87 -0
- package/dist/api/common.js.map +1 -0
- package/dist/api/graphql/all_app_extension_registrations.d.ts +20 -0
- package/dist/api/graphql/all_app_extension_registrations.js +20 -0
- package/dist/api/graphql/all_app_extension_registrations.js.map +1 -0
- package/dist/api/graphql/all_dev_stores_by_org.d.ts +18 -0
- package/dist/api/graphql/all_dev_stores_by_org.js +21 -0
- package/dist/api/graphql/all_dev_stores_by_org.js.map +1 -0
- package/dist/api/graphql/all_orgs.d.ts +12 -0
- package/dist/api/graphql/all_orgs.js +14 -0
- package/dist/api/graphql/all_orgs.js.map +1 -0
- package/dist/api/graphql/convert_dev_to_test_store.d.ts +16 -0
- package/dist/api/graphql/convert_dev_to_test_store.js +13 -0
- package/dist/api/graphql/convert_dev_to_test_store.js.map +1 -0
- package/dist/api/graphql/create_app.d.ts +29 -0
- package/dist/api/graphql/create_app.js +33 -0
- package/dist/api/graphql/create_app.js.map +1 -0
- package/dist/api/graphql/create_deployment.d.ts +33 -0
- package/dist/api/graphql/create_deployment.js +25 -0
- package/dist/api/graphql/create_deployment.js.map +1 -0
- package/dist/api/graphql/extension_create.d.ts +30 -0
- package/dist/api/graphql/extension_create.js +26 -0
- package/dist/api/graphql/extension_create.js.map +1 -0
- package/dist/api/graphql/extension_specifications.d.ts +27 -0
- package/dist/api/graphql/extension_specifications.js +22 -0
- package/dist/api/graphql/extension_specifications.js.map +1 -0
- package/dist/api/graphql/find_app.d.ts +14 -0
- package/dist/api/graphql/find_app.js +17 -0
- package/dist/api/graphql/find_app.js.map +1 -0
- package/dist/api/graphql/find_org.d.ts +18 -0
- package/dist/api/graphql/find_org.js +21 -0
- package/dist/api/graphql/find_org.js.map +1 -0
- package/dist/api/graphql/find_org_basic.d.ts +11 -0
- package/dist/api/graphql/find_org_basic.js +14 -0
- package/dist/api/graphql/find_org_basic.js.map +1 -0
- package/dist/api/graphql/find_store_by_domain.d.ts +21 -0
- package/dist/api/graphql/find_store_by_domain.js +24 -0
- package/dist/api/graphql/find_store_by_domain.js.map +1 -0
- package/dist/api/graphql/functions/api_schema_definition.d.ts +9 -0
- package/dist/api/graphql/functions/api_schema_definition.js +7 -0
- package/dist/api/graphql/functions/api_schema_definition.js.map +1 -0
- package/dist/api/graphql/functions/app_function_set.d.ts +30 -0
- package/dist/api/graphql/functions/app_function_set.js +38 -0
- package/dist/api/graphql/functions/app_function_set.js.map +1 -0
- package/dist/api/graphql/functions/function_service_proxy.d.ts +4 -0
- package/dist/api/graphql/functions/function_service_proxy.js +7 -0
- package/dist/api/graphql/functions/function_service_proxy.js.map +1 -0
- package/dist/api/graphql/functions/upload_url_generate.d.ts +12 -0
- package/dist/api/graphql/functions/upload_url_generate.js +11 -0
- package/dist/api/graphql/functions/upload_url_generate.js.map +1 -0
- package/dist/api/graphql/generate_signed_upload_url.d.ts +15 -0
- package/dist/api/graphql/generate_signed_upload_url.js +15 -0
- package/dist/api/graphql/generate_signed_upload_url.js.map +1 -0
- package/dist/api/graphql/get_urls.d.ts +10 -0
- package/dist/api/graphql/get_urls.js +10 -0
- package/dist/api/graphql/get_urls.js.map +1 -0
- package/dist/api/graphql/get_variant_id.d.ts +17 -0
- package/dist/api/graphql/get_variant_id.js +20 -0
- package/dist/api/graphql/get_variant_id.js.map +1 -0
- package/dist/api/graphql/index.d.ts +21 -0
- package/dist/api/graphql/index.js +22 -0
- package/dist/api/graphql/index.js.map +1 -0
- package/dist/api/graphql/update_draft.d.ts +33 -0
- package/dist/api/graphql/update_draft.js +24 -0
- package/dist/api/graphql/update_draft.js.map +1 -0
- package/dist/api/graphql/update_urls.d.ts +14 -0
- package/dist/api/graphql/update_urls.js +12 -0
- package/dist/api/graphql/update_urls.js.map +1 -0
- package/dist/api/identity.d.ts +1 -0
- package/dist/api/identity.js +41 -0
- package/dist/api/identity.js.map +1 -0
- package/dist/api/oxygen.d.ts +5 -0
- package/dist/api/oxygen.js +30 -0
- package/dist/api/oxygen.js.map +1 -0
- package/dist/api/partners.d.ts +14 -0
- package/dist/api/partners.js +44 -0
- package/dist/api/partners.js.map +1 -0
- package/dist/api.d.ts +6 -0
- package/dist/api.js +7 -0
- package/dist/api.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -0
- package/dist/constants.d.ts +52 -0
- package/dist/constants.js +71 -0
- package/dist/constants.js.map +1 -0
- package/dist/content-tokens.d.ts +44 -0
- package/dist/content-tokens.js +105 -0
- package/dist/content-tokens.js.map +1 -0
- package/dist/environment/fqdn.d.ts +29 -0
- package/dist/environment/fqdn.js +72 -0
- package/dist/environment/fqdn.js.map +1 -0
- package/dist/environment/local.d.ts +92 -0
- package/dist/environment/local.js +169 -0
- package/dist/environment/local.js.map +1 -0
- package/dist/environment/service.d.ts +4 -0
- package/dist/environment/service.js +19 -0
- package/dist/environment/service.js.map +1 -0
- package/dist/environment/spin-cache.d.ts +2 -0
- package/dist/environment/spin-cache.js +8 -0
- package/dist/environment/spin-cache.js.map +1 -0
- package/dist/environment/spin.d.ts +50 -0
- package/dist/environment/spin.js +99 -0
- package/dist/environment/spin.js.map +1 -0
- package/dist/environment/utilities.d.ts +8 -0
- package/dist/environment/utilities.js +19 -0
- package/dist/environment/utilities.js.map +1 -0
- package/dist/environment.d.ts +7 -0
- package/dist/environment.js +8 -0
- package/dist/environment.js.map +1 -0
- package/dist/error.d.ts +68 -0
- package/dist/error.js +143 -0
- package/dist/error.js.map +1 -0
- package/dist/file.d.ts +98 -0
- package/dist/file.js +216 -0
- package/dist/file.js.map +1 -0
- package/dist/git.d.ts +36 -0
- package/dist/git.js +133 -0
- package/dist/git.js.map +1 -0
- package/dist/http/fetch.d.ts +22 -0
- package/dist/http/fetch.js +44 -0
- package/dist/http/fetch.js.map +1 -0
- package/dist/http/formdata.d.ts +3 -0
- package/dist/http/formdata.js +6 -0
- package/dist/http/formdata.js.map +1 -0
- package/dist/http/graphql.d.ts +13 -0
- package/dist/http/graphql.js +12 -0
- package/dist/http/graphql.js.map +1 -0
- package/dist/http.d.ts +27 -0
- package/dist/http.js +32 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata.d.ts +53 -0
- package/dist/metadata.js +62 -0
- package/dist/metadata.js.map +1 -0
- package/dist/monorail.d.ts +100 -0
- package/dist/monorail.js +39 -0
- package/dist/monorail.js.map +1 -0
- package/dist/network/api.d.ts +2 -0
- package/dist/network/api.js +2 -0
- package/dist/network/api.js.map +1 -0
- package/dist/network/service.d.ts +14 -0
- package/dist/network/service.js +11 -0
- package/dist/network/service.js.map +1 -0
- package/dist/npm.d.ts +27 -0
- package/dist/npm.js +20 -0
- package/dist/npm.js.map +1 -0
- package/dist/output.d.ts +129 -0
- package/dist/output.js +310 -0
- package/dist/output.js.map +1 -0
- package/dist/path.d.ts +25 -0
- package/dist/path.js +48 -0
- package/dist/path.js.map +1 -0
- package/dist/plugins.d.ts +73 -0
- package/dist/plugins.js +49 -0
- package/dist/plugins.js.map +1 -0
- package/dist/private/common/json.d.ts +6 -0
- package/dist/private/common/json.js +2 -0
- package/dist/private/common/json.js.map +1 -0
- package/dist/private/common/lodash.d.ts +47 -0
- package/dist/private/common/lodash.js +2 -0
- package/dist/private/common/lodash.js.map +1 -0
- package/dist/private/node/analytics.d.ts +27 -0
- package/dist/private/node/analytics.js +57 -0
- package/dist/private/node/analytics.js.map +1 -0
- package/dist/private/node/ui/alert.d.ts +2 -0
- package/dist/private/node/ui/alert.js +18 -0
- package/dist/private/node/ui/alert.js.map +1 -0
- package/dist/private/node/ui/components/Alert.d.ts +17 -0
- package/dist/private/node/ui/components/Alert.js +21 -0
- package/dist/private/node/ui/components/Alert.js.map +1 -0
- package/dist/private/node/ui/components/Alert.test.d.ts +1 -0
- package/dist/private/node/ui/components/Alert.test.js +95 -0
- package/dist/private/node/ui/components/Alert.test.js.map +1 -0
- package/dist/private/node/ui/components/Banner.d.ts +8 -0
- package/dist/private/node/ui/components/Banner.js +41 -0
- package/dist/private/node/ui/components/Banner.js.map +1 -0
- package/dist/private/node/ui/components/Banner.test.d.ts +1 -0
- package/dist/private/node/ui/components/Banner.test.js +52 -0
- package/dist/private/node/ui/components/Banner.test.js.map +1 -0
- package/dist/private/node/ui/components/Command.d.ts +9 -0
- package/dist/private/node/ui/components/Command.js +13 -0
- package/dist/private/node/ui/components/Command.js.map +1 -0
- package/dist/private/node/ui/components/Command.test.d.ts +1 -0
- package/dist/private/node/ui/components/Command.test.js +11 -0
- package/dist/private/node/ui/components/Command.test.js.map +1 -0
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +47 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js +86 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -0
- package/dist/private/node/ui/components/ConcurrentOutput.test.d.ts +1 -0
- package/dist/private/node/ui/components/ConcurrentOutput.test.js +54 -0
- package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -0
- package/dist/private/node/ui/components/FatalError.d.ts +7 -0
- package/dist/private/node/ui/components/FatalError.js +54 -0
- package/dist/private/node/ui/components/FatalError.js.map +1 -0
- package/dist/private/node/ui/components/FatalError.test.d.ts +1 -0
- package/dist/private/node/ui/components/FatalError.test.js +119 -0
- package/dist/private/node/ui/components/FatalError.test.js.map +1 -0
- package/dist/private/node/ui/components/FilePath.d.ts +9 -0
- package/dist/private/node/ui/components/FilePath.js +13 -0
- package/dist/private/node/ui/components/FilePath.js.map +1 -0
- package/dist/private/node/ui/components/FilePath.test.d.ts +1 -0
- package/dist/private/node/ui/components/FilePath.test.js +11 -0
- package/dist/private/node/ui/components/FilePath.test.js.map +1 -0
- package/dist/private/node/ui/components/FullScreen.d.ts +8 -0
- package/dist/private/node/ui/components/FullScreen.js +32 -0
- package/dist/private/node/ui/components/FullScreen.js.map +1 -0
- package/dist/private/node/ui/components/Link.d.ts +10 -0
- package/dist/private/node/ui/components/Link.js +15 -0
- package/dist/private/node/ui/components/Link.js.map +1 -0
- package/dist/private/node/ui/components/Link.test.d.ts +1 -0
- package/dist/private/node/ui/components/Link.test.js +22 -0
- package/dist/private/node/ui/components/Link.test.js.map +1 -0
- package/dist/private/node/ui/components/List.d.ts +13 -0
- package/dist/private/node/ui/components/List.js +19 -0
- package/dist/private/node/ui/components/List.js.map +1 -0
- package/dist/private/node/ui/components/List.test.d.ts +1 -0
- package/dist/private/node/ui/components/List.test.js +34 -0
- package/dist/private/node/ui/components/List.test.js.map +1 -0
- package/dist/private/node/ui/components/SelectInput.d.ts +12 -0
- package/dist/private/node/ui/components/SelectInput.js +87 -0
- package/dist/private/node/ui/components/SelectInput.js.map +1 -0
- package/dist/private/node/ui/components/SelectInput.test.d.ts +1 -0
- package/dist/private/node/ui/components/SelectInput.test.js +230 -0
- package/dist/private/node/ui/components/SelectInput.test.js.map +1 -0
- package/dist/private/node/ui/components/SelectPrompt.d.ts +11 -0
- package/dist/private/node/ui/components/SelectPrompt.js +34 -0
- package/dist/private/node/ui/components/SelectPrompt.js.map +1 -0
- package/dist/private/node/ui/components/SelectPrompt.test.d.ts +1 -0
- package/dist/private/node/ui/components/SelectPrompt.test.js +74 -0
- package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -0
- package/dist/private/node/ui/components/Table.d.ts +8 -0
- package/dist/private/node/ui/components/Table.js +17 -0
- package/dist/private/node/ui/components/Table.js.map +1 -0
- package/dist/private/node/ui/components/Tasks.d.ts +10 -0
- package/dist/private/node/ui/components/Tasks.js +27 -0
- package/dist/private/node/ui/components/Tasks.js.map +1 -0
- package/dist/private/node/ui/components/Tasks.test.d.ts +1 -0
- package/dist/private/node/ui/components/Tasks.test.js +50 -0
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -0
- package/dist/private/node/ui/components/TextAnimation.d.ts +9 -0
- package/dist/private/node/ui/components/TextAnimation.js +35 -0
- package/dist/private/node/ui/components/TextAnimation.js.map +1 -0
- package/dist/private/node/ui/components/TextInput.d.ts +9 -0
- package/dist/private/node/ui/components/TextInput.js +74 -0
- package/dist/private/node/ui/components/TextInput.js.map +1 -0
- package/dist/private/node/ui/components/TextInput.test.d.ts +1 -0
- package/dist/private/node/ui/components/TextInput.test.js +139 -0
- package/dist/private/node/ui/components/TextInput.test.js.map +1 -0
- package/dist/private/node/ui/components/TextPrompt.d.ts +8 -0
- package/dist/private/node/ui/components/TextPrompt.js +52 -0
- package/dist/private/node/ui/components/TextPrompt.js.map +1 -0
- package/dist/private/node/ui/components/TextPrompt.test.d.ts +1 -0
- package/dist/private/node/ui/components/TextPrompt.test.js +68 -0
- package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -0
- package/dist/private/node/ui/components/TokenizedText.d.ts +36 -0
- package/dist/private/node/ui/components/TokenizedText.js +70 -0
- package/dist/private/node/ui/components/TokenizedText.js.map +1 -0
- package/dist/private/node/ui/components/TokenizedText.test.d.ts +1 -0
- package/dist/private/node/ui/components/TokenizedText.test.js +44 -0
- package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -0
- package/dist/private/node/ui/components/UserInput.d.ts +10 -0
- package/dist/private/node/ui/components/UserInput.js +11 -0
- package/dist/private/node/ui/components/UserInput.js.map +1 -0
- package/dist/private/node/ui/components/UserInput.test.d.ts +1 -0
- package/dist/private/node/ui/components/UserInput.test.js +11 -0
- package/dist/private/node/ui/components/UserInput.test.js.map +1 -0
- package/dist/private/node/ui/hooks/use-async-and-unmount.d.ts +6 -0
- package/dist/private/node/ui/hooks/use-async-and-unmount.js +17 -0
- package/dist/private/node/ui/hooks/use-async-and-unmount.js.map +1 -0
- package/dist/private/node/ui/hooks/use-layout.d.ts +6 -0
- package/dist/private/node/ui/hooks/use-layout.js +30 -0
- package/dist/private/node/ui/hooks/use-layout.js.map +1 -0
- package/dist/private/node/ui.d.ts +23 -0
- package/dist/private/node/ui.js +53 -0
- package/dist/private/node/ui.js.map +1 -0
- package/dist/public/common/array.d.ts +37 -0
- package/dist/public/common/array.js +51 -0
- package/dist/public/common/array.js.map +1 -0
- package/dist/public/common/collection.d.ts +23 -0
- package/dist/public/common/collection.js +29 -0
- package/dist/public/common/collection.js.map +1 -0
- package/dist/public/common/function.d.ts +30 -0
- package/dist/public/common/function.js +40 -0
- package/dist/public/common/function.js.map +1 -0
- package/dist/public/common/lang.d.ts +16 -0
- package/dist/public/common/lang.js +22 -0
- package/dist/public/common/lang.js.map +1 -0
- package/dist/public/common/object.d.ts +32 -0
- package/dist/public/common/object.js +45 -0
- package/dist/public/common/object.js.map +1 -0
- package/dist/public/common/string.d.ts +6 -0
- package/dist/public/common/string.js +109 -0
- package/dist/public/common/string.js.map +1 -0
- package/dist/public/common/url.d.ts +7 -0
- package/dist/public/common/url.js +17 -0
- package/dist/public/common/url.js.map +1 -0
- package/dist/public/node/abort.d.ts +16 -0
- package/dist/public/node/abort.js +17 -0
- package/dist/public/node/abort.js.map +1 -0
- package/dist/public/node/analytics.d.ts +13 -0
- package/dist/public/node/analytics.js +82 -0
- package/dist/public/node/analytics.js.map +1 -0
- package/dist/public/node/archiver.d.ts +9 -0
- package/dist/public/node/archiver.js +34 -0
- package/dist/public/node/archiver.js.map +1 -0
- package/dist/public/node/base-command.d.ts +26 -0
- package/dist/public/node/base-command.js +172 -0
- package/dist/public/node/base-command.js.map +1 -0
- package/dist/public/node/checksum.d.ts +20 -0
- package/dist/public/node/checksum.js +32 -0
- package/dist/public/node/checksum.js.map +1 -0
- package/dist/public/node/cli.d.ts +29 -0
- package/dist/public/node/cli.js +106 -0
- package/dist/public/node/cli.js.map +1 -0
- package/dist/public/node/colors.d.ts +2 -0
- package/dist/public/node/colors.js +3 -0
- package/dist/public/node/colors.js.map +1 -0
- package/dist/public/node/dot-env.d.ts +42 -0
- package/dist/public/node/dot-env.js +67 -0
- package/dist/public/node/dot-env.js.map +1 -0
- package/dist/public/node/error-handler.d.ts +41 -0
- package/dist/public/node/error-handler.js +198 -0
- package/dist/public/node/error-handler.js.map +1 -0
- package/dist/public/node/error.d.ts +4 -0
- package/dist/public/node/error.js +5 -0
- package/dist/public/node/error.js.map +1 -0
- package/dist/public/node/framework.d.ts +8 -0
- package/dist/public/node/framework.js +135 -0
- package/dist/public/node/framework.js.map +1 -0
- package/dist/public/node/fs.d.ts +17 -0
- package/dist/public/node/fs.js +21 -0
- package/dist/public/node/fs.js.map +1 -0
- package/dist/public/node/github.d.ts +50 -0
- package/dist/public/node/github.js +71 -0
- package/dist/public/node/github.js.map +1 -0
- package/dist/public/node/hooks/postrun.d.ts +2 -0
- package/dist/public/node/hooks/postrun.js +9 -0
- package/dist/public/node/hooks/postrun.js.map +1 -0
- package/dist/public/node/hooks/prerun.d.ts +12 -0
- package/dist/public/node/hooks/prerun.js +66 -0
- package/dist/public/node/hooks/prerun.js.map +1 -0
- package/dist/public/node/node-package-manager.d.ts +243 -0
- package/dist/public/node/node-package-manager.js +369 -0
- package/dist/public/node/node-package-manager.js.map +1 -0
- package/dist/public/node/os.d.ts +16 -0
- package/dist/public/node/os.js +77 -0
- package/dist/public/node/os.js.map +1 -0
- package/dist/public/node/plugins/tunnel.d.ts +47 -0
- package/dist/public/node/plugins/tunnel.js +19 -0
- package/dist/public/node/plugins/tunnel.js.map +1 -0
- package/dist/public/node/presets.d.ts +8 -0
- package/dist/public/node/presets.js +26 -0
- package/dist/public/node/presets.js.map +1 -0
- package/dist/public/node/result.d.ts +94 -0
- package/dist/public/node/result.js +134 -0
- package/dist/public/node/result.js.map +1 -0
- package/dist/public/node/ruby.d.ts +38 -0
- package/dist/public/node/ruby.js +234 -0
- package/dist/public/node/ruby.js.map +1 -0
- package/dist/public/node/semver.d.ts +3 -0
- package/dist/public/node/semver.js +6 -0
- package/dist/public/node/semver.js.map +1 -0
- package/dist/public/node/tcp.d.ts +5 -0
- package/dist/public/node/tcp.js +35 -0
- package/dist/public/node/tcp.js.map +1 -0
- package/dist/public/node/ui.d.ts +184 -0
- package/dist/public/node/ui.js +203 -0
- package/dist/public/node/ui.js.map +1 -0
- package/dist/schema.d.ts +1 -0
- package/dist/schema.js +2 -0
- package/dist/schema.js.map +1 -0
- package/dist/secure-store.d.ts +19 -0
- package/dist/secure-store.js +63 -0
- package/dist/secure-store.js.map +1 -0
- package/dist/session/authorize.d.ts +7 -0
- package/dist/session/authorize.js +52 -0
- package/dist/session/authorize.js.map +1 -0
- package/dist/session/device-authorization.d.ts +32 -0
- package/dist/session/device-authorization.js +92 -0
- package/dist/session/device-authorization.js.map +1 -0
- package/dist/session/exchange.d.ts +48 -0
- package/dist/session/exchange.js +159 -0
- package/dist/session/exchange.js.map +1 -0
- package/dist/session/identity.d.ts +3 -0
- package/dist/session/identity.js +58 -0
- package/dist/session/identity.js.map +1 -0
- package/dist/session/post-auth.d.ts +13 -0
- package/dist/session/post-auth.js +62 -0
- package/dist/session/post-auth.js.map +1 -0
- package/dist/session/redirect-listener.d.ts +34 -0
- package/dist/session/redirect-listener.js +106 -0
- package/dist/session/redirect-listener.js.map +1 -0
- package/dist/session/schema.d.ts +175 -0
- package/dist/session/schema.js +60 -0
- package/dist/session/schema.js.map +1 -0
- package/dist/session/scopes.d.ts +16 -0
- package/dist/session/scopes.js +53 -0
- package/dist/session/scopes.js.map +1 -0
- package/dist/session/store.d.ts +24 -0
- package/dist/session/store.js +89 -0
- package/dist/session/store.js.map +1 -0
- package/dist/session/token.d.ts +40 -0
- package/dist/session/token.js +22 -0
- package/dist/session/token.js.map +1 -0
- package/dist/session/validate.d.ts +17 -0
- package/dist/session/validate.js +65 -0
- package/dist/session/validate.js.map +1 -0
- package/dist/session.d.ts +96 -0
- package/dist/session.js +293 -0
- package/dist/session.js.map +1 -0
- package/dist/store/schema.d.ts +3 -0
- package/dist/store/schema.js +27 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store.d.ts +53 -0
- package/dist/store.js +134 -0
- package/dist/store.js.map +1 -0
- package/dist/string.d.ts +28 -0
- package/dist/string.js +77 -0
- package/dist/string.js.map +1 -0
- package/dist/system.d.ts +51 -0
- package/dist/system.js +128 -0
- package/dist/system.js.map +1 -0
- package/dist/template.d.ts +11 -0
- package/dist/template.js +50 -0
- package/dist/template.js.map +1 -0
- package/dist/testing/output.d.ts +10 -0
- package/dist/testing/output.js +16 -0
- package/dist/testing/output.js.map +1 -0
- package/dist/testing/store.d.ts +7 -0
- package/dist/testing/store.js +26 -0
- package/dist/testing/store.js.map +1 -0
- package/dist/testing/ui.d.ts +5 -0
- package/dist/testing/ui.js +23 -0
- package/dist/testing/ui.js.map +1 -0
- package/dist/toml.d.ts +3 -0
- package/dist/toml.js +8 -0
- package/dist/toml.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/typing/deep-required.d.ts +12 -0
- package/dist/typing/deep-required.js +2 -0
- package/dist/typing/deep-required.js.map +1 -0
- package/dist/typing/overloaded-parameters.d.ts +6 -0
- package/dist/typing/overloaded-parameters.js +2 -0
- package/dist/typing/overloaded-parameters.js.map +1 -0
- package/dist/typing/pick-by-prefix.d.ts +12 -0
- package/dist/typing/pick-by-prefix.js +2 -0
- package/dist/typing/pick-by-prefix.js.map +1 -0
- package/dist/typing/simple-definitions.d.ts +4 -0
- package/dist/typing/simple-definitions.js +2 -0
- package/dist/typing/simple-definitions.js.map +1 -0
- package/dist/ui/executor.d.ts +14 -0
- package/dist/ui/executor.js +90 -0
- package/dist/ui/executor.js.map +1 -0
- package/dist/ui/inquirer/autocomplete.d.ts +11 -0
- package/dist/ui/inquirer/autocomplete.js +110 -0
- package/dist/ui/inquirer/autocomplete.js.map +1 -0
- package/dist/ui/inquirer/input.d.ts +16 -0
- package/dist/ui/inquirer/input.js +45 -0
- package/dist/ui/inquirer/input.js.map +1 -0
- package/dist/ui/inquirer/password.d.ts +7 -0
- package/dist/ui/inquirer/password.js +8 -0
- package/dist/ui/inquirer/password.js.map +1 -0
- package/dist/ui/inquirer/select.d.ts +14 -0
- package/dist/ui/inquirer/select.js +26 -0
- package/dist/ui/inquirer/select.js.map +1 -0
- package/dist/ui.d.ts +54 -0
- package/dist/ui.js +128 -0
- package/dist/ui.js.map +1 -0
- package/dist/vscode.d.ts +8 -0
- package/dist/vscode.js +36 -0
- package/dist/vscode.js.map +1 -0
- package/package.json +177 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-package-manager.js","sourceRoot":"","sources":["../../../src/public/node/node-package-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AACnC,OAAO,EAAC,eAAe,EAAc,MAAM,YAAY,CAAA;AACvD,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAC,MAAM,IAAI,UAAU,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,IAAI,SAAS,EAAC,MAAM,eAAe,CAAA;AACxF,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAC,MAAM,eAAe,CAAA;AACtF,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAA;AAClC,OAAO,aAAa,MAAM,gBAAgB,CAAA;AAI1C,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAA;AAEvC,oCAAo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,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;IAC5D,MAAM,WAAW,GAAG,MAAM,wBAAwB,CAAC,aAAa,CAAC,CAAA;IACjE,8DAA8D;IAC9D,MAAM,OAAO,GAAI,WAAW,CAAC,OAAe,CAAC,OAAO,CAAA;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,GAAG,CAAC,OAAO,CAAA,4BAA4B,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;KAC3G;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import {AbortError, BugError} from './error.js'\nimport {Version} from './semver.js'\nimport {AbortController, AbortSignal} from './abort.js'\nimport {exec} from '../../system.js'\nimport {exists as fileExists, read as readFile, write as writeFile} from '../../file.js'\nimport {glob, dirname, join as pathJoin, findUp, moduleDirectory} from '../../path.js'\nimport {token, content, debug} from '../../output.js'\nimport {Bug} from '../../error.js'\nimport latestVersion from 'latest-version'\nimport type {Writable} from 'stream'\nimport type {ExecOptions} from '../../system.js'\n\n/** The name of the Yarn lock file */\nexport const yarnLockfile = 'yarn.lock'\n\n/** The name of the npm lock file */\nexport const npmLockfile = 'package-lock.json'\n\n/** The name of the pnpm lock file */\nexport const pnpmLockfile = 'pnpm-lock.yaml'\n\n/** The name of the pnpm workspace file */\nexport const pnpmWorkspaceFile = 'pnpm-workspace.yaml'\n\n/** An array containing the lockfiles from all the package managers */\nexport const lockfiles: Lockfile[] = [yarnLockfile, pnpmLockfile, npmLockfile]\nexport type Lockfile = 'yarn.lock' | 'package-lock.json' | 'pnpm-lock.yaml'\n\n/**\n * A union type that represents the type of dependencies in the package.json\n * - dev: devDependencies\n * - prod: dependencies\n * - peer: peerDependencies\n */\nexport type DependencyType = 'dev' | 'prod' | 'peer'\n\n/**\n * A union that represents the package managers available.\n */\nexport const packageManager = ['yarn', 'npm', 'pnpm'] as const\nexport type PackageManager = typeof packageManager[number]\n\n/**\n * Returns an abort error that's thrown when a directory that's expected to have\n * a package.json doesn't have it.\n * @param directory - The path to the directory that should contain a package.json\n * @returns An abort error.\n */\nexport const PackageJsonNotFoundError = (directory: string): AbortError => {\n return new AbortError(`The directory ${directory} doesn't have a package.json.`)\n}\n\n/**\n * Returns a bug error that's thrown when the lookup of the package.json traversing the directory\n * hierarchy up can't find a package.json\n * @param directory - The directory from which the traverse has been done\n * @returns An abort error.\n */\nexport const FindUpAndReadPackageJsonNotFoundError = (directory: string): BugError => {\n return new BugError(content`Couldn't find a a package.json traversing directories from ${token.path(directory)}`)\n}\n\n/**\n * Returns the dependency manager used to run the create workflow.\n * @param env - The environment variables of the process in which the CLI runs.\n * @returns The dependency manager\n */\nexport function packageManagerUsedForCreating(env = process.env): PackageManager | 'unknown' {\n if (env.npm_config_user_agent?.includes('yarn')) {\n return 'yarn'\n } else if (env.npm_config_user_agent?.includes('pnpm')) {\n return 'pnpm'\n } else if (env.npm_config_user_agent?.includes('npm')) {\n return 'npm'\n }\n return 'unknown'\n}\n\n/**\n * Returns the dependency manager used by an existing project.\n * @param directory - The root directory of the project.\n * @returns The dependency manager\n */\nexport async function getPackageManager(directory: string): Promise<PackageManager> {\n debug(content`Obtaining the dependency manager in directory ${token.path(directory)}...`)\n const yarnLockPath = pathJoin(directory, yarnLockfile)\n const pnpmLockPath = pathJoin(directory, pnpmLockfile)\n if (await fileExists(yarnLockPath)) {\n return 'yarn'\n } else if (await fileExists(pnpmLockPath)) {\n return 'pnpm'\n } else {\n return 'npm'\n }\n}\n\ninterface InstallNPMDependenciesRecursivelyOptions {\n /**\n * The dependency manager to use to install the dependencies.\n */\n packageManager: PackageManager\n /**\n * The directory from where we'll find package.json's recursively\n */\n directory: string\n\n /**\n * Specifies the maximum depth of the glob search.\n */\n deep?: number\n}\n\n/**\n * This function traverses down a directory tree to find directories containing a package.json\n * and installs the dependencies if needed. To know if it's needed, it uses the \"check\" command\n * provided by dependency managers.\n * @param options - Options to install dependencies recursively.\n */\nexport async function installNPMDependenciesRecursively(\n options: InstallNPMDependenciesRecursivelyOptions,\n): Promise<void> {\n const packageJsons = await glob(pathJoin(options.directory, '**/package.json'), {\n ignore: [pathJoin(options.directory, 'node_modules/**/package.json')],\n cwd: options.directory,\n onlyFiles: true,\n deep: options.deep,\n })\n const abortController = new AbortController()\n try {\n await Promise.all(\n packageJsons.map(async (packageJsonPath) => {\n const directory = dirname(packageJsonPath)\n await installNodeModules({\n directory,\n packageManager: options.packageManager,\n stdout: undefined,\n stderr: undefined,\n signal: abortController.signal,\n args: [],\n })\n }),\n )\n } catch (error) {\n abortController.abort()\n throw error\n }\n}\n\ninterface InstallNodeModulesOptions {\n directory: string\n args: string[]\n packageManager: PackageManager\n stdout?: Writable\n stderr?: Writable\n signal?: AbortSignal\n}\n\nexport async function installNodeModules(options: InstallNodeModulesOptions): Promise<void> {\n const execOptions: ExecOptions = {\n cwd: options.directory,\n stdin: undefined,\n stdout: options.stdout,\n stderr: options.stderr,\n signal: options.signal,\n }\n let args = ['install']\n if (options.args) {\n args = args.concat(options.args)\n }\n await exec(options.packageManager, args, execOptions)\n}\n\n/**\n * Returns the name of the package configured in its package.json\n * @param packageJsonPath - Path to the package.json file\n * @returns A promise that resolves with the name.\n */\nexport async function getPackageName(packageJsonPath: string): Promise<string | undefined> {\n const packageJsonContent = await readAndParsePackageJson(packageJsonPath)\n return packageJsonContent.name\n}\n\n/**\n * Returns the list of production and dev dependencies of a package.json\n * @param packageJsonPath - Path to the package.json file\n * @returns A promise that resolves with the list of dependencies.\n */\nexport async function getDependencies(packageJsonPath: string): Promise<{[key: string]: string}> {\n const packageJsonContent = await readAndParsePackageJson(packageJsonPath)\n const dependencies: {[key: string]: string} = packageJsonContent.dependencies ?? {}\n const devDependencies: {[key: string]: string} = packageJsonContent.devDependencies ?? {}\n\n return {...dependencies, ...devDependencies}\n}\n\n/**\n * Returns true if the app uses workspaces, false otherwise.\n * @param packageJsonPath - Path to the package.json file\n * @param pnpmWorkspacePath - Path to the pnpm-workspace.yaml file\n * @returns A promise that resolves with true if the app uses workspaces, false otherwise.\n */\nexport async function usesWorkspaces(appDirectory: string): Promise<boolean> {\n const packageJsonPath = pathJoin(appDirectory, 'package.json')\n const packageJsonContent = await readAndParsePackageJson(packageJsonPath)\n const pnpmWorkspacePath = pathJoin(appDirectory, pnpmWorkspaceFile)\n return Boolean(packageJsonContent.workspaces) || fileExists(pnpmWorkspacePath)\n}\n\n/**\n * Given an NPM dependency, it checks if there's a more recent version, and if there is, it returns its value.\n * @param dependency - The dependency name (e.g. react)\n * @param currentVersion - The current version.\n * @returns A promise that resolves with a more recent version or undefined if there's no more recent version.\n */\nexport async function checkForNewVersion(dependency: string, currentVersion: string): Promise<string | undefined> {\n debug(content`Checking if there's a version of ${dependency} newer than ${currentVersion}`)\n try {\n const lastVersion = await getLatestNPMPackageVersion(dependency)\n if (lastVersion && new Version(currentVersion).compare(lastVersion) < 0) {\n return lastVersion\n } else {\n return undefined\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n return undefined\n }\n}\n\n/**\n * An interface that represents a package.json\n */\nexport interface PackageJson {\n /**\n * The name attribute of the package.json\n */\n name?: string\n\n /**\n * The version attribute of the package.json\n */\n version?: string\n\n /**\n * The dependencies attribute of the package.json\n */\n dependencies?: {[key: string]: string}\n\n /**\n * The devDependencies attribute of the package.json\n */\n devDependencies?: {[key: string]: string}\n\n /**\n * The optional oclif settings attribute of the package.json\n */\n oclif?: {\n plugins?: string[]\n }\n\n /**\n * The workspaces attribute of the package.json\n */\n workspaces?: string[]\n\n /**\n * The resolutions attribute of the package.json. Only useful when using yarn as package manager\n */\n resolutions?: {[key: string]: string}\n\n /**\n * The overrides attribute of the package.json. Only useful when using npm o npmn as package managers\n */\n overrides?: {[key: string]: string}\n}\n\n/**\n * Reads and parses a package.json\n * @param packageJsonPath - Path to the package.json\n * @returns An promise that resolves with an in-memory representation\n * of the package.json or rejects with an error if the file is not found or the content is\n * not decodable.\n */\nexport async function readAndParsePackageJson(packageJsonPath: string): Promise<PackageJson> {\n if (!(await fileExists(packageJsonPath))) {\n throw PackageJsonNotFoundError(dirname(packageJsonPath))\n }\n return JSON.parse(await readFile(packageJsonPath))\n}\n\ninterface AddNPMDependenciesIfNeededOptions {\n /** How dependencies should be added */\n type: DependencyType\n\n /** The dependency manager to use to add dependencies */\n packageManager: PackageManager\n\n /** The directory that contains the package.json where dependencies will be added */\n directory: string\n\n /** Standard output coming from the underlying installation process */\n stdout?: Writable\n\n /** Standard error coming from the underlying installation process */\n stderr?: Writable\n\n /** Abort signal to stop the process */\n signal?: AbortSignal\n}\n\n/**\n * An interface that represents a dependency name with its version\n */\nexport interface DependencyVersion {\n /**\n * The name of the NPM dependency as it's reflected in the package.json:\n *\n * @example\n * In the example below name would be \"react\"\n * ```\n * {\n * \"react\": \"1.2.3\"\n * }\n * ```\n */\n name: string\n\n /**\n * The version of the NPM dependency as it's reflected in the package.json:\n *\n * @example\n * In the example below version would be \"1.2.3\"\n * ```\n * {\n * \"react\": \"1.2.3\"\n * }\n * ```\n */\n version: string | undefined\n}\n\n/**\n * Adds dependencies to a Node project (i.e. a project that has a package.json)\n * @param dependencies - List of dependencies to be added.\n * @param options - Options for adding dependencies.\n */\nexport async function addNPMDependenciesIfNeeded(\n dependencies: DependencyVersion[],\n options: AddNPMDependenciesIfNeededOptions,\n): Promise<void> {\n debug(content`Adding the following dependencies if needed:\n${token.json(dependencies)}\nWith options:\n${token.json(options)}\n `)\n const packageJsonPath = pathJoin(options.directory, 'package.json')\n if (!(await fileExists(packageJsonPath))) {\n throw PackageJsonNotFoundError(options.directory)\n }\n const existingDependencies = Object.keys(await getDependencies(packageJsonPath))\n let dependenciesToAdd = dependencies\n dependenciesToAdd = dependencies.filter((dep) => {\n return !existingDependencies.includes(dep.name)\n })\n if (dependenciesToAdd.length === 0) {\n return\n }\n await addNPMDependencies(dependenciesToAdd, options)\n}\n\nexport async function addNPMDependencies(\n dependencies: DependencyVersion[],\n options: AddNPMDependenciesIfNeededOptions,\n): Promise<void> {\n let args: string[]\n const depedenciesWithVersion = dependencies.map((dep) => {\n return dep.version ? `${dep.name}@${dep.version}` : dep.name\n })\n switch (options.packageManager) {\n case 'npm':\n args = argumentsToAddDependenciesWithNPM(depedenciesWithVersion, options.type)\n break\n case 'yarn':\n args = argumentsToAddDependenciesWithYarn(depedenciesWithVersion, options.type)\n break\n case 'pnpm':\n args = argumentsToAddDependenciesWithPNPM(depedenciesWithVersion, options.type)\n break\n }\n options.stdout?.write(`Executing... ${[options.packageManager, ...args].join(' ')}`)\n await exec(options.packageManager, args, {\n cwd: options.directory,\n stdout: options.stdout,\n stderr: options.stderr,\n signal: options.signal,\n })\n}\n\nexport async function addNPMDependenciesWithoutVersionIfNeeded(\n dependencies: string[],\n options: AddNPMDependenciesIfNeededOptions,\n): Promise<void> {\n await addNPMDependenciesIfNeeded(\n dependencies.map((dependency) => {\n return {name: dependency, version: undefined}\n }),\n options,\n )\n}\n\n/**\n * Returns the arguments to add dependencies using NPM.\n * @param dependencies - The list of dependencies to add\n * @param type - The dependency type.\n * @returns An array with the arguments.\n */\nfunction argumentsToAddDependenciesWithNPM(dependencies: string[], type: DependencyType): string[] {\n let command = ['install']\n command = command.concat(dependencies)\n switch (type) {\n case 'dev':\n command.push('--save-dev')\n break\n case 'peer':\n command.push('--save-peer')\n break\n case 'prod':\n command.push('--save-prod')\n break\n }\n return command\n}\n\n/**\n * Returns the arguments to add dependencies using Yarn.\n * @param dependencies - The list of dependencies to add\n * @param type - The dependency type.\n * @returns An array with the arguments.\n */\nfunction argumentsToAddDependenciesWithYarn(dependencies: string[], type: DependencyType): string[] {\n let command = ['add']\n command = command.concat(dependencies)\n switch (type) {\n case 'dev':\n command.push('--dev')\n break\n case 'peer':\n command.push('--peer')\n break\n case 'prod':\n command.push('--prod')\n break\n }\n return command\n}\n\n/**\n * Returns the arguments to add dependencies using PNPM.\n * @param dependencies - The list of dependencies to add\n * @param type - The dependency type.\n * @returns An array with the arguments.\n */\nfunction argumentsToAddDependenciesWithPNPM(dependencies: string[], type: DependencyType): string[] {\n let command = ['add']\n command = command.concat(dependencies)\n switch (type) {\n case 'dev':\n command.push('--save-dev')\n break\n case 'peer':\n command.push('--save-peer')\n break\n case 'prod':\n command.push('--save-prod')\n break\n }\n return command\n}\n\n/**\n * Given a directory it traverses the directory up looking for a package.json and if found, it reads it\n * decodes the JSON, and returns its content as a Javascript object.\n * @param options - The directory from which traverse up.\n * @returns If found, the promise resolves with the path to the\n * package.json and its content. If not found, it throws a FindUpAndReadPackageJsonNotFoundError error.\n */\nexport async function findUpAndReadPackageJson(fromDirectory: string): Promise<{path: string; content: unknown}> {\n const packageJsonPath = await findUp('package.json', {cwd: fromDirectory, type: 'file'})\n if (packageJsonPath) {\n const packageJson = JSON.parse(await readFile(packageJsonPath))\n return {path: packageJsonPath, content: packageJson}\n } else {\n throw FindUpAndReadPackageJsonNotFoundError(fromDirectory)\n }\n}\n\nexport async function addResolutionOrOverride(directory: string, dependencies: {[key: string]: string}): Promise<void> {\n const packageManager = await getPackageManager(directory)\n const packageJsonPath = pathJoin(directory, 'package.json')\n const packageJsonContent = await readAndParsePackageJson(packageJsonPath)\n\n if (packageManager === 'yarn') {\n packageJsonContent.resolutions = packageJsonContent.resolutions\n ? {...packageJsonContent.resolutions, ...dependencies}\n : dependencies\n }\n if (packageManager === 'npm' || packageManager === 'pnpm') {\n packageJsonContent.overrides = packageJsonContent.overrides\n ? {...packageJsonContent.overrides, ...dependencies}\n : dependencies\n }\n\n await writeFile(packageJsonPath, JSON.stringify(packageJsonContent, null, 2))\n}\n\n/**\n * Returns the latest available version of an NPM package.\n * @param name - The name of the NPM package.\n * @returns A promise to get the latest available version of a package.\n */\nasync function getLatestNPMPackageVersion(name: string) {\n debug(content`Getting the latest version of NPM package: ${token.raw(name)}`)\n return latestVersion(name)\n}\n\ninterface FindPackageVersionUpOptions {\n fromModuleURL: import('url').URL | string\n}\n\n/**\n * Given a module URL, it traverses the directory hierarchy up until it finds a package.json\n * and then it returns the version in it.\n * @param options - Options\n * @returns The version if it can find the package.json and it exists. An error otherwise.\n */\nexport async function findPackageVersionUp(options: FindPackageVersionUpOptions): Promise<string> {\n const fromDirectory = moduleDirectory(options.fromModuleURL)\n const packageJson = await findUpAndReadPackageJson(fromDirectory)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const version = (packageJson.content as any).version\n if (!version) {\n throw new Bug(content`The package.json at path ${token.path(packageJson.path)} doesn't contain a version`)\n }\n return version\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param platform - The platform to get the username for. Defaults to the current platform.
|
|
3
|
+
* @returns The username of the current user.
|
|
4
|
+
*/
|
|
5
|
+
export declare function username(platform?: typeof process.platform): Promise<string | null>;
|
|
6
|
+
declare type PlatformArch = Exclude<typeof process.arch, 'x64' | 'ia32'> | 'amd64' | '386';
|
|
7
|
+
declare type PlatformStrings = Exclude<typeof process.platform, 'win32'> | 'windows';
|
|
8
|
+
/**
|
|
9
|
+
* Returns the platform and architecture.
|
|
10
|
+
* @returns Returns the current platform and architecture.
|
|
11
|
+
*/
|
|
12
|
+
export declare function platformAndArch(platform?: typeof process.platform, arch?: typeof process.arch): {
|
|
13
|
+
platform: PlatformStrings;
|
|
14
|
+
arch: PlatformArch;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { debug, content } from '../../output.js';
|
|
2
|
+
import { execa } from 'execa';
|
|
3
|
+
import { userInfo as osUserInfo } from 'os';
|
|
4
|
+
// This code has been vendored from https://github.com/sindresorhus/username
|
|
5
|
+
// because adding it as a transtive dependency causes conflicts with other
|
|
6
|
+
// packages that haven't been yet migrated to the latest version.
|
|
7
|
+
/**
|
|
8
|
+
* @param platform - The platform to get the username for. Defaults to the current platform.
|
|
9
|
+
* @returns The username of the current user.
|
|
10
|
+
*/
|
|
11
|
+
export async function username(platform = process.platform) {
|
|
12
|
+
debug(content `Obtaining user name...`);
|
|
13
|
+
const environmentVariable = getEnvironmentVariable();
|
|
14
|
+
if (environmentVariable) {
|
|
15
|
+
return environmentVariable;
|
|
16
|
+
}
|
|
17
|
+
const userInfoUsername = getUsernameFromOsUserInfo();
|
|
18
|
+
if (userInfoUsername) {
|
|
19
|
+
return userInfoUsername;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
First we try to get the ID of the user and then the actual username. We do this because in `docker run --user <uid>:<gid>` context, we don't have "username" available. Therefore, we have a fallback to `makeUsernameFromId` for such scenario. Applies also to the `sync()` method below.
|
|
23
|
+
*/
|
|
24
|
+
try {
|
|
25
|
+
if (platform === 'win32') {
|
|
26
|
+
const { stdout } = await execa('whoami');
|
|
27
|
+
return cleanWindowsCommand(stdout);
|
|
28
|
+
}
|
|
29
|
+
const { stdout: userId } = await execa('id', ['-u']);
|
|
30
|
+
try {
|
|
31
|
+
const { stdout } = await execa('id', ['-un', userId]);
|
|
32
|
+
return stdout;
|
|
33
|
+
// eslint-disable-next-line no-catch-all/no-catch-all,no-empty
|
|
34
|
+
}
|
|
35
|
+
catch { }
|
|
36
|
+
return makeUsernameFromId(userId);
|
|
37
|
+
// eslint-disable-next-line no-catch-all/no-catch-all
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns the platform and architecture.
|
|
45
|
+
* @returns Returns the current platform and architecture.
|
|
46
|
+
*/
|
|
47
|
+
export function platformAndArch(platform = process.platform, arch = process.arch) {
|
|
48
|
+
let archString = arch;
|
|
49
|
+
if (arch === 'x64') {
|
|
50
|
+
archString = 'amd64';
|
|
51
|
+
}
|
|
52
|
+
if (arch === 'ia32') {
|
|
53
|
+
archString = '386';
|
|
54
|
+
}
|
|
55
|
+
const platformString = (platform.match(/^win.+/) ? 'windows' : platform);
|
|
56
|
+
return { platform: platformString, arch: archString };
|
|
57
|
+
}
|
|
58
|
+
function getEnvironmentVariable() {
|
|
59
|
+
const { env } = process;
|
|
60
|
+
return env.SUDO_USER || env.C9_USER || env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
|
|
61
|
+
}
|
|
62
|
+
function getUsernameFromOsUserInfo() {
|
|
63
|
+
try {
|
|
64
|
+
return osUserInfo().username;
|
|
65
|
+
// eslint-disable-next-line no-catch-all/no-catch-all
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function cleanWindowsCommand(value) {
|
|
72
|
+
return value.replace(/^.*\\/, '');
|
|
73
|
+
}
|
|
74
|
+
function makeUsernameFromId(userId) {
|
|
75
|
+
return `no-username-${userId}`;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=os.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"os.js","sourceRoot":"","sources":["../../../src/public/node/os.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAC,KAAK,EAAC,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAC,QAAQ,IAAI,UAAU,EAAC,MAAM,IAAI,CAAA;AAEzC,4EAA4E;AAC5E,0EAA0E;AAC1E,iEAAiE;AACjE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,WAAoC,OAAO,CAAC,QAAQ;IACjF,KAAK,CAAC,OAAO,CAAA,wBAAwB,CAAC,CAAA;IACtC,MAAM,mBAAmB,GAAG,sBAAsB,EAAE,CAAA;IACpD,IAAI,mBAAmB,EAAE;QACvB,OAAO,mBAAmB,CAAA;KAC3B;IAED,MAAM,gBAAgB,GAAG,yBAAyB,EAAE,CAAA;IACpD,IAAI,gBAAgB,EAAE;QACpB,OAAO,gBAAgB,CAAA;KACxB;IAED;;QAEI;IACJ,IAAI;QACF,IAAI,QAAQ,KAAK,OA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IAAI,GAAG,CAAC,QAAQ,CAAA;AAC7F,CAAC;AAED,SAAS,yBAAyB;IAChC,IAAI;QACF,OAAO,UAAU,EAAE,CAAC,QAAQ,CAAA;QAC5B,qDAAqD;KACtD;IAAC,MAAM;QACN,OAAO,IAAI,CAAA;KACZ;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AACnC,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAc;IACxC,OAAO,eAAe,MAAM,EAAE,CAAA;AAChC,CAAC","sourcesContent":["import {debug, content} from '../../output.js'\nimport {execa} from 'execa'\nimport {userInfo as osUserInfo} from 'os'\n\n// This code has been vendored from https://github.com/sindresorhus/username\n// because adding it as a transtive dependency causes conflicts with other\n// packages that haven't been yet migrated to the latest version.\n/**\n * @param platform - The platform to get the username for. Defaults to the current platform.\n * @returns The username of the current user.\n */\nexport async function username(platform: typeof process.platform = process.platform): Promise<string | null> {\n debug(content`Obtaining user name...`)\n const environmentVariable = getEnvironmentVariable()\n if (environmentVariable) {\n return environmentVariable\n }\n\n const userInfoUsername = getUsernameFromOsUserInfo()\n if (userInfoUsername) {\n return userInfoUsername\n }\n\n /**\n First we try to get the ID of the user and then the actual username. We do this because in `docker run --user <uid>:<gid>` context, we don't have \"username\" available. Therefore, we have a fallback to `makeUsernameFromId` for such scenario. Applies also to the `sync()` method below.\n */\n try {\n if (platform === 'win32') {\n const {stdout} = await execa('whoami')\n return cleanWindowsCommand(stdout)\n }\n\n const {stdout: userId} = await execa('id', ['-u'])\n try {\n const {stdout} = await execa('id', ['-un', userId])\n return stdout\n\n // eslint-disable-next-line no-catch-all/no-catch-all,no-empty\n } catch {}\n return makeUsernameFromId(userId)\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return null\n }\n}\n\ntype PlatformArch = Exclude<typeof process.arch, 'x64' | 'ia32'> | 'amd64' | '386'\ntype PlatformStrings = Exclude<typeof process.platform, 'win32'> | 'windows'\n/**\n * Returns the platform and architecture.\n * @returns Returns the current platform and architecture.\n */\nexport function platformAndArch(\n platform: typeof process.platform = process.platform,\n arch: typeof process.arch = process.arch,\n): {\n platform: PlatformStrings\n arch: PlatformArch\n} {\n let archString = arch\n if (arch === 'x64') {\n archString = 'amd64'\n }\n if (arch === 'ia32') {\n archString = '386'\n }\n const platformString = (platform.match(/^win.+/) ? 'windows' : platform) as PlatformStrings\n return {platform: platformString, arch: archString}\n}\n\nfunction getEnvironmentVariable() {\n const {env} = process\n\n return env.SUDO_USER || env.C9_USER || env.LOGNAME || env.USER || env.LNAME || env.USERNAME\n}\n\nfunction getUsernameFromOsUserInfo(): string | null {\n try {\n return osUserInfo().username\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return null\n }\n}\n\nfunction cleanWindowsCommand(value: string) {\n return value.replace(/^.*\\\\/, '')\n}\n\nfunction makeUsernameFromId(userId: string) {\n return `no-username-${userId}`\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Result } from '../result.js';
|
|
2
|
+
import { FanoutHookFunction, PluginReturnsForHook } from '../../../plugins.js';
|
|
3
|
+
import { ExtendableError } from '../../../error.js';
|
|
4
|
+
export declare type TunnelErrorType = 'invalid-provider' | 'tunnel-already-running' | 'wrong-credentials' | 'unknown';
|
|
5
|
+
export declare class TunnelError extends ExtendableError {
|
|
6
|
+
type: TunnelErrorType;
|
|
7
|
+
constructor(type: TunnelErrorType, message?: string);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Tunnel Plugins types
|
|
11
|
+
*
|
|
12
|
+
* Any plugin that provides tunnel functionality should implement `defineProvider`and `startTunnel`
|
|
13
|
+
*/
|
|
14
|
+
export interface HookReturnPerTunnelPlugin {
|
|
15
|
+
tunnel_start: {
|
|
16
|
+
options: {
|
|
17
|
+
port: number;
|
|
18
|
+
provider: string;
|
|
19
|
+
};
|
|
20
|
+
pluginReturns: {
|
|
21
|
+
[pluginName: string]: Result<{
|
|
22
|
+
url: string;
|
|
23
|
+
}, TunnelError>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
tunnel_provider: {
|
|
27
|
+
options: {
|
|
28
|
+
[key: string]: never;
|
|
29
|
+
};
|
|
30
|
+
pluginReturns: {
|
|
31
|
+
[pluginName: string]: {
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export declare type TunnelProviderFunction = FanoutHookFunction<'tunnel_provider', ''>;
|
|
38
|
+
export declare type TunnelStartFunction = FanoutHookFunction<'tunnel_start', ''>;
|
|
39
|
+
export declare type TunnelStartReturn = PluginReturnsForHook<'tunnel_start', ''>;
|
|
40
|
+
export declare type TunnelStartAction = (port: number) => Promise<TunnelStartReturn>;
|
|
41
|
+
export declare const defineProvider: (input: {
|
|
42
|
+
name: string;
|
|
43
|
+
}) => TunnelProviderFunction;
|
|
44
|
+
export declare const startTunnel: (options: {
|
|
45
|
+
provider: string;
|
|
46
|
+
action: TunnelStartAction;
|
|
47
|
+
}) => TunnelStartFunction;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { err } from '../result.js';
|
|
2
|
+
import { ExtendableError } from '../../../error.js';
|
|
3
|
+
export class TunnelError extends ExtendableError {
|
|
4
|
+
constructor(type, message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.type = type;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export const defineProvider = (input) => {
|
|
10
|
+
return async () => input;
|
|
11
|
+
};
|
|
12
|
+
export const startTunnel = (options) => {
|
|
13
|
+
return async (inputs) => {
|
|
14
|
+
if (inputs.provider !== options.provider)
|
|
15
|
+
return err(new TunnelError('invalid-provider'));
|
|
16
|
+
return options.action(inputs.port);
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=tunnel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tunnel.js","sourceRoot":"","sources":["../../../../src/public/node/plugins/tunnel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAS,MAAM,cAAc,CAAA;AAExC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AAGjD,MAAM,OAAO,WAAY,SAAQ,eAAe;IAE9C,YAAY,IAAqB,EAAE,OAAgB;QACjD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AA2BD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAqB,EAA0B,EAAE;IAC9E,OAAO,KAAK,IAAI,EAAE,CAAC,KAAK,CAAA;AAC1B,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAsD,EAAuB,EAAE;IACzG,OAAO,KAAK,EAAE,MAAwC,EAA8B,EAAE;QACpF,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ;YAAE,OAAO,GAAG,CAAC,IAAI,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAA;QACzF,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC,CAAA;AACH,CAAC,CAAA","sourcesContent":["import {err, Result} from '../result.js'\nimport {FanoutHookFunction, PluginReturnsForHook} from '../../../plugins.js'\nimport {ExtendableError} from '../../../error.js'\n\nexport type TunnelErrorType = 'invalid-provider' | 'tunnel-already-running' | 'wrong-credentials' | 'unknown'\nexport class TunnelError extends ExtendableError {\n type: TunnelErrorType\n constructor(type: TunnelErrorType, message?: string) {\n super(message)\n this.type = type\n }\n}\n\n/**\n * Tunnel Plugins types\n *\n * Any plugin that provides tunnel functionality should implement `defineProvider`and `startTunnel`\n */\nexport interface HookReturnPerTunnelPlugin {\n tunnel_start: {\n options: {port: number; provider: string}\n pluginReturns: {\n [pluginName: string]: Result<{url: string}, TunnelError>\n }\n }\n tunnel_provider: {\n options: {[key: string]: never}\n pluginReturns: {\n [pluginName: string]: {name: string}\n }\n }\n}\n\nexport type TunnelProviderFunction = FanoutHookFunction<'tunnel_provider', ''>\nexport type TunnelStartFunction = FanoutHookFunction<'tunnel_start', ''>\nexport type TunnelStartReturn = PluginReturnsForHook<'tunnel_start', ''>\nexport type TunnelStartAction = (port: number) => Promise<TunnelStartReturn>\n\nexport const defineProvider = (input: {name: string}): TunnelProviderFunction => {\n return async () => input\n}\nexport const startTunnel = (options: {provider: string; action: TunnelStartAction}): TunnelStartFunction => {\n return async (inputs: {provider: string; port: number}): Promise<TunnelStartReturn> => {\n if (inputs.provider !== options.provider) return err(new TunnelError('invalid-provider'))\n return options.action(inputs.port)\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JsonMap } from '../../private/common/json.js';
|
|
2
|
+
export declare const presetsFilename = "shopify.presets.toml";
|
|
3
|
+
export interface Presets {
|
|
4
|
+
[name: string]: JsonMap;
|
|
5
|
+
}
|
|
6
|
+
export declare function loadPresetsFromDirectory(dir: string, opts?: {
|
|
7
|
+
findUp: boolean;
|
|
8
|
+
}): Promise<Presets>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { exists as fileExists, read as fileRead } from '../../file.js';
|
|
2
|
+
import { findUp, join as pathJoin } from '../../path.js';
|
|
3
|
+
import { decode as tomlDecode } from '../../toml.js';
|
|
4
|
+
export const presetsFilename = 'shopify.presets.toml';
|
|
5
|
+
export async function loadPresetsFromDirectory(dir, opts) {
|
|
6
|
+
let presetsFilePath;
|
|
7
|
+
if (opts?.findUp) {
|
|
8
|
+
presetsFilePath = await findUp(presetsFilename, {
|
|
9
|
+
cwd: dir,
|
|
10
|
+
type: 'file',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
const allowedPresetsFilePath = pathJoin(dir, presetsFilename);
|
|
15
|
+
if (await fileExists(allowedPresetsFilePath)) {
|
|
16
|
+
presetsFilePath = allowedPresetsFilePath;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (presetsFilePath) {
|
|
20
|
+
return tomlDecode(await fileRead(presetsFilePath));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../src/public/node/presets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,IAAI,UAAU,EAAE,IAAI,IAAI,QAAQ,EAAC,MAAM,eAAe,CAAA;AAEpE,OAAO,EAAC,MAAM,EAAE,IAAI,IAAI,QAAQ,EAAC,MAAM,eAAe,CAAA;AACtD,OAAO,EAAC,MAAM,IAAI,UAAU,EAAC,MAAM,eAAe,CAAA;AAElD,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAA;AAKrD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,GAAW,EAAE,IAAwB;IAClF,IAAI,eAAmC,CAAA;IACvC,IAAI,IAAI,EAAE,MAAM,EAAE;QAChB,eAAe,GAAG,MAAM,MAAM,CAAC,eAAe,EAAE;YAC9C,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,MAAM;SACb,CAAC,CAAA;KACH;SAAM;QACL,MAAM,sBAAsB,GAAG,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAC,CAAA;QAC7D,IAAI,MAAM,UAAU,CAAC,sBAAsB,CAAC,EAAE;YAC5C,eAAe,GAAG,sBAAsB,CAAA;SACzC;KACF;IACD,IAAI,eAAe,EAAE;QACnB,OAAO,UAAU,CAAC,MAAM,QAAQ,CAAC,eAAe,CAAC,CAAY,CAAA;KAC9D;SAAM;QACL,OAAO,EAAa,CAAA;KACrB;AACH,CAAC","sourcesContent":["import {exists as fileExists, read as fileRead} from '../../file.js'\nimport {JsonMap} from '../../private/common/json.js'\nimport {findUp, join as pathJoin} from '../../path.js'\nimport {decode as tomlDecode} from '../../toml.js'\n\nexport const presetsFilename = 'shopify.presets.toml'\n\nexport interface Presets {\n [name: string]: JsonMap\n}\nexport async function loadPresetsFromDirectory(dir: string, opts?: {findUp: boolean}): Promise<Presets> {\n let presetsFilePath: string | undefined\n if (opts?.findUp) {\n presetsFilePath = await findUp(presetsFilename, {\n cwd: dir,\n type: 'file',\n })\n } else {\n const allowedPresetsFilePath = pathJoin(dir, presetsFilename)\n if (await fileExists(allowedPresetsFilePath)) {\n presetsFilePath = allowedPresetsFilePath\n }\n }\n if (presetsFilePath) {\n return tomlDecode(await fileRead(presetsFilePath)) as Presets\n } else {\n return {} as Presets\n }\n}\n"]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export declare type Result<TValue, TError> = Ok<TValue, TError> | Err<TValue, TError>;
|
|
2
|
+
/**
|
|
3
|
+
* Utility metho to create an `Ok` result from a `value`
|
|
4
|
+
*
|
|
5
|
+
* @param value - `value` used to crete the `Result`
|
|
6
|
+
* @returns an instance of a `Ok` `Result` inferring its type
|
|
7
|
+
*/
|
|
8
|
+
export declare const ok: <TValue, TError = never>(value: TValue) => Ok<TValue, TError>;
|
|
9
|
+
/**
|
|
10
|
+
* Utility method to create an `Error` result from an `error`
|
|
11
|
+
*
|
|
12
|
+
* @param err - `error` used to crete the `Result`
|
|
13
|
+
* @returns an instance of an `Error` `Result` inferring its type
|
|
14
|
+
*/
|
|
15
|
+
export declare const err: <TValue = never, TError = unknown>(err: TError) => Err<TValue, TError>;
|
|
16
|
+
export declare class Ok<TValue, TError> {
|
|
17
|
+
readonly value: TValue;
|
|
18
|
+
constructor(value: TValue);
|
|
19
|
+
/**
|
|
20
|
+
* Check if a `Result` is an `Err` inferring its type. `!isErr()` should be used before accessing the `value`
|
|
21
|
+
*
|
|
22
|
+
* @returns `false` as the `Resul` is `OK`
|
|
23
|
+
*/
|
|
24
|
+
isErr(): this is Err<TValue, TError>;
|
|
25
|
+
/**
|
|
26
|
+
* Runs the `handler` method an return the same an unaltered copy of the `Result`. It could be used to log an
|
|
27
|
+
* output when the result is `Ok` without breaking the flow
|
|
28
|
+
*
|
|
29
|
+
* @param handler - method to be run when the result is `Ok`
|
|
30
|
+
* @returns a copy of the same `Result`
|
|
31
|
+
*/
|
|
32
|
+
doOnOk(handler: (value: TValue) => void): Result<TValue, TError>;
|
|
33
|
+
/**
|
|
34
|
+
* A safe mode to throw the `error` of the `Result`
|
|
35
|
+
*/
|
|
36
|
+
valueOrBug(): TValue;
|
|
37
|
+
/**
|
|
38
|
+
* Throws an abort error if the result doesn't represent a value.
|
|
39
|
+
*/
|
|
40
|
+
valueOrAbort(): TValue;
|
|
41
|
+
/**
|
|
42
|
+
* Maps the value to another one with a different type. It leaves the `Error` type unaltered
|
|
43
|
+
*
|
|
44
|
+
* @param mapper - The mapper method to apply an `OK` value
|
|
45
|
+
* @returns a new result with the new mapped value
|
|
46
|
+
*/
|
|
47
|
+
map<TMappedValue>(mapper: (value: TValue) => TMappedValue): Result<TMappedValue, TError>;
|
|
48
|
+
/**
|
|
49
|
+
* Maps the error type to another one. It leaves the `Ok` type and value unaltered
|
|
50
|
+
*
|
|
51
|
+
* @param _mapper - This mapper method is not used for an `Ok` value
|
|
52
|
+
* @returns a new result with the new mapped error type and an value
|
|
53
|
+
*/
|
|
54
|
+
mapError<TMappedError>(_mapper: (error: TError) => TMappedError): Result<TValue, TMappedError>;
|
|
55
|
+
}
|
|
56
|
+
export declare class Err<TValue, TError> {
|
|
57
|
+
readonly error: TError;
|
|
58
|
+
constructor(error: TError);
|
|
59
|
+
/**
|
|
60
|
+
* Check if a `Result` is an `Err` inferring its type. `!isErr()` should be used before accessing the `value`
|
|
61
|
+
*
|
|
62
|
+
* @returns `false` as the `Resul` is `OK`
|
|
63
|
+
*/
|
|
64
|
+
isErr(): this is Err<TValue, TError>;
|
|
65
|
+
/**
|
|
66
|
+
* Return an unaltered copy of the `Error` without doing anything.
|
|
67
|
+
*
|
|
68
|
+
* @param _handler - This handler method is not used for an `Error`
|
|
69
|
+
* @returns a copy of the same `Error`
|
|
70
|
+
*/
|
|
71
|
+
doOnOk(_handler: (value: TValue) => void): Result<TValue, TError>;
|
|
72
|
+
/**
|
|
73
|
+
* A safe mode to throw the `error` of the `Result`
|
|
74
|
+
*/
|
|
75
|
+
valueOrBug(): TValue;
|
|
76
|
+
/**
|
|
77
|
+
* Throws an abort error if the result doesn't represent a value.
|
|
78
|
+
*/
|
|
79
|
+
valueOrAbort(): TValue;
|
|
80
|
+
/**
|
|
81
|
+
* Maps the value type to another one. It leaves the `Error` unaltered
|
|
82
|
+
*
|
|
83
|
+
* @param _mapper - This mapper method is not used for an `Error` value
|
|
84
|
+
* @returns a new result with the new value type and an unaltered error
|
|
85
|
+
*/
|
|
86
|
+
map<TMappedValue>(_mapper: (valueOrBug: TValue) => TMappedValue): Result<TMappedValue, TError>;
|
|
87
|
+
/**
|
|
88
|
+
* Maps the error to another one with a different type. It leaves the value type unaltered
|
|
89
|
+
*
|
|
90
|
+
* @param mapper - The mapper method to apply an `Error` value
|
|
91
|
+
* @returns a new result with the new mapped error
|
|
92
|
+
*/
|
|
93
|
+
mapError<TMappedError>(mapper: (error: TError) => TMappedError): Result<TValue, TMappedError>;
|
|
94
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { FatalError } from './error.js';
|
|
2
|
+
import { Abort, ExtendableError } from '../../error.js';
|
|
3
|
+
/**
|
|
4
|
+
* Utility metho to create an `Ok` result from a `value`
|
|
5
|
+
*
|
|
6
|
+
* @param value - `value` used to crete the `Result`
|
|
7
|
+
* @returns an instance of a `Ok` `Result` inferring its type
|
|
8
|
+
*/
|
|
9
|
+
export const ok = (value) => new Ok(value);
|
|
10
|
+
/**
|
|
11
|
+
* Utility method to create an `Error` result from an `error`
|
|
12
|
+
*
|
|
13
|
+
* @param err - `error` used to crete the `Result`
|
|
14
|
+
* @returns an instance of an `Error` `Result` inferring its type
|
|
15
|
+
*/
|
|
16
|
+
export const err = (err) => new Err(err);
|
|
17
|
+
export class Ok {
|
|
18
|
+
constructor(value) {
|
|
19
|
+
this.value = value;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Check if a `Result` is an `Err` inferring its type. `!isErr()` should be used before accessing the `value`
|
|
23
|
+
*
|
|
24
|
+
* @returns `false` as the `Resul` is `OK`
|
|
25
|
+
*/
|
|
26
|
+
isErr() {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Runs the `handler` method an return the same an unaltered copy of the `Result`. It could be used to log an
|
|
31
|
+
* output when the result is `Ok` without breaking the flow
|
|
32
|
+
*
|
|
33
|
+
* @param handler - method to be run when the result is `Ok`
|
|
34
|
+
* @returns a copy of the same `Result`
|
|
35
|
+
*/
|
|
36
|
+
doOnOk(handler) {
|
|
37
|
+
handler(this.value);
|
|
38
|
+
return ok(this.value);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A safe mode to throw the `error` of the `Result`
|
|
42
|
+
*/
|
|
43
|
+
valueOrBug() {
|
|
44
|
+
return this.value;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Throws an abort error if the result doesn't represent a value.
|
|
48
|
+
*/
|
|
49
|
+
valueOrAbort() {
|
|
50
|
+
return this.value;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Maps the value to another one with a different type. It leaves the `Error` type unaltered
|
|
54
|
+
*
|
|
55
|
+
* @param mapper - The mapper method to apply an `OK` value
|
|
56
|
+
* @returns a new result with the new mapped value
|
|
57
|
+
*/
|
|
58
|
+
map(mapper) {
|
|
59
|
+
return ok(mapper(this.value));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Maps the error type to another one. It leaves the `Ok` type and value unaltered
|
|
63
|
+
*
|
|
64
|
+
* @param _mapper - This mapper method is not used for an `Ok` value
|
|
65
|
+
* @returns a new result with the new mapped error type and an value
|
|
66
|
+
*/
|
|
67
|
+
mapError(_mapper) {
|
|
68
|
+
return ok(this.value);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export class Err {
|
|
72
|
+
// eslint-disable-next-line node/handle-callback-err
|
|
73
|
+
constructor(error) {
|
|
74
|
+
this.error = error;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Check if a `Result` is an `Err` inferring its type. `!isErr()` should be used before accessing the `value`
|
|
78
|
+
*
|
|
79
|
+
* @returns `false` as the `Resul` is `OK`
|
|
80
|
+
*/
|
|
81
|
+
isErr() {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Return an unaltered copy of the `Error` without doing anything.
|
|
86
|
+
*
|
|
87
|
+
* @param _handler - This handler method is not used for an `Error`
|
|
88
|
+
* @returns a copy of the same `Error`
|
|
89
|
+
*/
|
|
90
|
+
doOnOk(_handler) {
|
|
91
|
+
return err(this.error);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A safe mode to throw the `error` of the `Result`
|
|
95
|
+
*/
|
|
96
|
+
valueOrBug() {
|
|
97
|
+
throw this.error;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Throws an abort error if the result doesn't represent a value.
|
|
101
|
+
*/
|
|
102
|
+
valueOrAbort() {
|
|
103
|
+
if (this.error instanceof FatalError) {
|
|
104
|
+
throw this.error;
|
|
105
|
+
}
|
|
106
|
+
else if (this.error instanceof ExtendableError || this.error instanceof Error) {
|
|
107
|
+
const error = new Abort(this.error.message);
|
|
108
|
+
error.stack = this.error.stack;
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
throw new Abort(`${this.error}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Maps the value type to another one. It leaves the `Error` unaltered
|
|
117
|
+
*
|
|
118
|
+
* @param _mapper - This mapper method is not used for an `Error` value
|
|
119
|
+
* @returns a new result with the new value type and an unaltered error
|
|
120
|
+
*/
|
|
121
|
+
map(_mapper) {
|
|
122
|
+
return err(this.error);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Maps the error to another one with a different type. It leaves the value type unaltered
|
|
126
|
+
*
|
|
127
|
+
* @param mapper - The mapper method to apply an `Error` value
|
|
128
|
+
* @returns a new result with the new mapped error
|
|
129
|
+
*/
|
|
130
|
+
mapError(mapper) {
|
|
131
|
+
return err(mapper(this.error));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/public/node/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAA;AAIrD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG,CAAyB,KAAa,EAAsB,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAA;AAE9F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAmC,GAAW,EAAuB,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;AAEvG,MAAM,OAAO,EAAE;IACb,YAAqB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAEtC;;;;OAIG;IACH,KAAK;QACH,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,OAAgC;QACrC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnB,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI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D,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAChC,CAAC;CACF","sourcesContent":["import {FatalError} from './error.js'\nimport {Abort, ExtendableError} from '../../error.js'\n\nexport type Result<TValue, TError> = Ok<TValue, TError> | Err<TValue, TError>\n\n/**\n * Utility metho to create an `Ok` result from a `value`\n *\n * @param value - `value` used to crete the `Result`\n * @returns an instance of a `Ok` `Result` inferring its type\n */\nexport const ok = <TValue, TError = never>(value: TValue): Ok<TValue, TError> => new Ok(value)\n\n/**\n * Utility method to create an `Error` result from an `error`\n *\n * @param err - `error` used to crete the `Result`\n * @returns an instance of an `Error` `Result` inferring its type\n */\nexport const err = <TValue = never, TError = unknown>(err: TError): Err<TValue, TError> => new Err(err)\n\nexport class Ok<TValue, TError> {\n constructor(readonly value: TValue) {}\n\n /**\n * Check if a `Result` is an `Err` inferring its type. `!isErr()` should be used before accessing the `value`\n *\n * @returns `false` as the `Resul` is `OK`\n */\n isErr(): this is Err<TValue, TError> {\n return false\n }\n\n /**\n * Runs the `handler` method an return the same an unaltered copy of the `Result`. It could be used to log an\n * output when the result is `Ok` without breaking the flow\n *\n * @param handler - method to be run when the result is `Ok`\n * @returns a copy of the same `Result`\n */\n doOnOk(handler: (value: TValue) => void): Result<TValue, TError> {\n handler(this.value)\n return ok(this.value)\n }\n\n /**\n * A safe mode to throw the `error` of the `Result`\n */\n valueOrBug(): TValue {\n return this.value\n }\n\n /**\n * Throws an abort error if the result doesn't represent a value.\n */\n valueOrAbort(): TValue {\n return this.value\n }\n\n /**\n * Maps the value to another one with a different type. It leaves the `Error` type unaltered\n *\n * @param mapper - The mapper method to apply an `OK` value\n * @returns a new result with the new mapped value\n */\n map<TMappedValue>(mapper: (value: TValue) => TMappedValue): Result<TMappedValue, TError> {\n return ok(mapper(this.value))\n }\n\n /**\n * Maps the error type to another one. It leaves the `Ok` type and value unaltered\n *\n * @param _mapper - This mapper method is not used for an `Ok` value\n * @returns a new result with the new mapped error type and an value\n */\n mapError<TMappedError>(_mapper: (error: TError) => TMappedError): Result<TValue, TMappedError> {\n return ok(this.value)\n }\n}\n\nexport class Err<TValue, TError> {\n // eslint-disable-next-line node/handle-callback-err\n constructor(readonly error: TError) {}\n\n /**\n * Check if a `Result` is an `Err` inferring its type. `!isErr()` should be used before accessing the `value`\n *\n * @returns `false` as the `Resul` is `OK`\n */\n isErr(): this is Err<TValue, TError> {\n return true\n }\n\n /**\n * Return an unaltered copy of the `Error` without doing anything.\n *\n * @param _handler - This handler method is not used for an `Error`\n * @returns a copy of the same `Error`\n */\n doOnOk(_handler: (value: TValue) => void): Result<TValue, TError> {\n return err(this.error)\n }\n\n /**\n * A safe mode to throw the `error` of the `Result`\n */\n valueOrBug(): TValue {\n throw this.error\n }\n\n /**\n * Throws an abort error if the result doesn't represent a value.\n */\n valueOrAbort(): TValue {\n if (this.error instanceof FatalError) {\n throw this.error\n } else if (this.error instanceof ExtendableError || this.error instanceof Error) {\n const error = new Abort(this.error.message)\n error.stack = this.error.stack\n throw error\n } else {\n throw new Abort(`${this.error}`)\n }\n }\n\n /**\n * Maps the value type to another one. It leaves the `Error` unaltered\n *\n * @param _mapper - This mapper method is not used for an `Error` value\n * @returns a new result with the new value type and an unaltered error\n */\n map<TMappedValue>(_mapper: (valueOrBug: TValue) => TMappedValue): Result<TMappedValue, TError> {\n return err(this.error)\n }\n\n /**\n * Maps the error to another one with a different type. It leaves the value type unaltered\n *\n * @param mapper - The mapper method to apply an `Error` value\n * @returns a new result with the new mapped error\n */\n mapError<TMappedError>(mapper: (error: TError) => TMappedError): Result<TValue, TMappedError> {\n return err(mapper(this.error))\n }\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { AbortSignal } from './abort.js';
|
|
3
|
+
import { AdminSession } from '../../session.js';
|
|
4
|
+
import { Writable } from 'stream';
|
|
5
|
+
interface ExecCLI2Options {
|
|
6
|
+
adminSession?: AdminSession;
|
|
7
|
+
storefrontToken?: string;
|
|
8
|
+
token?: string;
|
|
9
|
+
directory?: string;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Execute CLI 2.0 commands.
|
|
14
|
+
* Installs a version of RubyCLI as a vendor dependency in a hidden folder in the system.
|
|
15
|
+
* User must have a valid ruby+bundler environment to run any command.
|
|
16
|
+
*
|
|
17
|
+
* @param args - List of argumets to execute. (ex: ['theme', 'pull'])
|
|
18
|
+
* @param options - Options to customize the execution of cli2.
|
|
19
|
+
*/
|
|
20
|
+
export declare function execCLI2(args: string[], { adminSession, storefrontToken, token, directory, signal }?: ExecCLI2Options): Promise<void>;
|
|
21
|
+
interface ExecThemeCheckCLIOptions {
|
|
22
|
+
/** A list of directories in which theme-check should run */
|
|
23
|
+
directories: string[];
|
|
24
|
+
/** Arguments to pass to the theme-check CLI */
|
|
25
|
+
args?: string[];
|
|
26
|
+
/** Writable to send standard output content through */
|
|
27
|
+
stdout: Writable;
|
|
28
|
+
/** Writable to send standard error content through */
|
|
29
|
+
stderr: Writable;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A function that installs (if needed) and runs the theme-check CLI.
|
|
33
|
+
* @param options - Options to customize the execution of theme-check.
|
|
34
|
+
* @returns A promise that resolves or rejects depending on the result of the underlying theme-check process.
|
|
35
|
+
*/
|
|
36
|
+
export declare function execThemeCheckCLI({ directories, args, stdout, stderr, }: ExecThemeCheckCLIOptions): Promise<void[]>;
|
|
37
|
+
export declare function version(): Promise<string | undefined>;
|
|
38
|
+
export {};
|