@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,70 @@
|
|
|
1
|
+
import { Command } from './Command.js';
|
|
2
|
+
import { Link } from './Link.js';
|
|
3
|
+
import { List } from './List.js';
|
|
4
|
+
import { UserInput } from './UserInput.js';
|
|
5
|
+
import { FilePath } from './FilePath.js';
|
|
6
|
+
import { Box, Text } from 'ink';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
function tokenToBlock(token) {
|
|
9
|
+
return {
|
|
10
|
+
display: typeof token !== 'string' && 'list' in token ? 'block' : 'inline',
|
|
11
|
+
value: token,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function splitByDisplayType(acc, item) {
|
|
15
|
+
if (item.display === 'block') {
|
|
16
|
+
acc.push([item]);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const last = acc[acc.length - 1];
|
|
20
|
+
if (last && last[0].display === 'inline') {
|
|
21
|
+
last.push(item);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
acc.push([item]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return acc;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* `TokenizedText` renders a text string with tokens that can be either strings,
|
|
31
|
+
* links, and commands.
|
|
32
|
+
*/
|
|
33
|
+
const TokenizedText = ({ item }) => {
|
|
34
|
+
if (typeof item === 'string') {
|
|
35
|
+
return React.createElement(Text, null, item);
|
|
36
|
+
}
|
|
37
|
+
else if ('command' in item) {
|
|
38
|
+
return React.createElement(Command, { command: item.command });
|
|
39
|
+
}
|
|
40
|
+
else if ('link' in item) {
|
|
41
|
+
return React.createElement(Link, { ...item.link });
|
|
42
|
+
}
|
|
43
|
+
else if ('char' in item) {
|
|
44
|
+
return React.createElement(Text, null, item.char[0]);
|
|
45
|
+
}
|
|
46
|
+
else if ('userInput' in item) {
|
|
47
|
+
return React.createElement(UserInput, { userInput: item.userInput });
|
|
48
|
+
}
|
|
49
|
+
else if ('filePath' in item) {
|
|
50
|
+
return React.createElement(FilePath, { filePath: item.filePath });
|
|
51
|
+
}
|
|
52
|
+
else if ('list' in item) {
|
|
53
|
+
return React.createElement(List, { ...item.list });
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const groupedItems = item.map(tokenToBlock).reduce(splitByDisplayType, []);
|
|
57
|
+
return (React.createElement(Box, { flexDirection: "column" }, groupedItems.map((items, groupIndex) => {
|
|
58
|
+
if (items[0].display === 'inline') {
|
|
59
|
+
return (React.createElement(Text, { key: groupIndex }, items.map((item, itemIndex) => (React.createElement(Text, { key: itemIndex },
|
|
60
|
+
itemIndex !== 0 && !(typeof item.value !== 'string' && 'char' in item.value) && React.createElement(Text, null, " "),
|
|
61
|
+
React.createElement(TokenizedText, { item: item.value }))))));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return React.createElement(List, { key: groupIndex, items: items[0].value.list.items });
|
|
65
|
+
}
|
|
66
|
+
})));
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export { TokenizedText };
|
|
70
|
+
//# sourceMappingURL=TokenizedText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenizedText.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TokenizedText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAA;AACtC,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAyCzB,SAAS,YAAY,CAAC,KAAY;IAChC,OAAO;QACL,OAAO,EAAE,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;QAC1E,KAAK,EAAE,KAAK;KACb,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAc,EAAE,IAAW;IACrD,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO,EAAE;QAC5B,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;KACjB;SAAM;QACL,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAChC,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,CAAE,CAAC,OAAO,KAAK,QAAQ,EAAE;YACzC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SAChB;aAAM;YACL,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;SACjB;KACF;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAMD;;;GAGG;AACH,MAAM,aAAa,GAAoB,CAAC,EAAC,IAAI,EAAC,EAAE,EAAE;IAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,oBAAC,IAAI,QAAE,IAAI,CAAQ,CAAA;KAC3B;SAAM,IAAI,SAAS,IAAI,IAAI,EAAE;QAC5B,OAAO,oBAAC,OAAO,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI,CAAA;KAC1C;SAAM,IAAI,MAAM,IAAI,IAAI,EAAE;QACzB,OAAO,oBAAC,IAAI,OAAK,IAAI,CAAC,IAAI,GAAI,CAAA;KAC/B;SAAM,IAAI,MAAM,IAAI,IAAI,EAAE;QACzB,OAAO,oBAAC,IAAI,QAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAQ,CAAA;KACnC;SAAM,IAAI,WAAW,IAAI,IAAI,EAAE;QAC9B,OAAO,oBAAC,SAAS,IAAC,SAAS,EAAE,IAAI,CAAC,SAAS,GAAI,CAAA;KAChD;SAAM,IAAI,UAAU,IAAI,IAAI,EAAE;QAC7B,OAAO,oBAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,GAAI,CAAA;KAC7C;SAAM,IAAI,MAAM,IAAI,IAAI,EAAE;QACzB,OAAO,oBAAC,IAAI,OAAK,IAAI,CAAC,IAAI,GAAI,CAAA;KAC/B;SAAM;QACL,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;QAE1E,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,IACxB,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;YACtC,IAAI,KAAK,CAAC,CAAC,CAAE,CAAC,OAAO,KAAK,QAAQ,EAAE;gBAClC,OAAO,CACL,oBAAC,IAAI,IAAC,GAAG,EAAE,UAAU,IAClB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAC9B,oBAAC,IAAI,IAAC,GAAG,EAAE,SAAS;oBACjB,SAAS,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,oBAAC,IAAI,YAAS;oBAC/F,oBAAC,aAAa,IAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAI,CAC9B,CACR,CAAC,CACG,CACR,CAAA;aACF;iBAAM;gBACL,OAAO,oBAAC,IAAI,IAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAG,KAAK,CAAC,CAAC,CAAE,CAAC,KAAmB,CAAC,IAAI,CAAC,KAAK,GAAI,CAAA;aACnF;QACH,CAAC,CAAC,CACE,CACP,CAAA;KACF;AACH,CAAC,CAAA;AAED,OAAO,EAAC,aAAa,EAAC,CAAA","sourcesContent":["import {Command} from './Command.js'\nimport {Link} from './Link.js'\nimport {List} from './List.js'\nimport {UserInput} from './UserInput.js'\nimport {FilePath} from './FilePath.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\n\ninterface CommandToken {\n command: string\n}\n\ninterface LinkToken {\n link: {\n label?: string\n url: string\n }\n}\n\ninterface CharToken {\n char: string\n}\n\ninterface UserInputToken {\n userInput: string\n}\n\ninterface FilePathToken {\n filePath: string\n}\n\ninterface ListToken {\n list: {\n items: TokenItem[]\n ordered?: boolean\n }\n}\n\ntype Token = string | CommandToken | LinkToken | CharToken | UserInputToken | FilePathToken | ListToken\nexport type TokenItem = Token | Token[]\n\ntype DisplayType = 'block' | 'inline'\ninterface Block {\n display: DisplayType\n value: Token\n}\n\nfunction tokenToBlock(token: Token): Block {\n return {\n display: typeof token !== 'string' && 'list' in token ? 'block' : 'inline',\n value: token,\n }\n}\n\nfunction splitByDisplayType(acc: Block[][], item: Block) {\n if (item.display === 'block') {\n acc.push([item])\n } else {\n const last = acc[acc.length - 1]\n if (last && last[0]!.display === 'inline') {\n last.push(item)\n } else {\n acc.push([item])\n }\n }\n return acc\n}\n\ninterface Props {\n item: TokenItem\n}\n\n/**\n * `TokenizedText` renders a text string with tokens that can be either strings,\n * links, and commands.\n */\nconst TokenizedText: React.FC<Props> = ({item}) => {\n if (typeof item === 'string') {\n return <Text>{item}</Text>\n } else if ('command' in item) {\n return <Command command={item.command} />\n } else if ('link' in item) {\n return <Link {...item.link} />\n } else if ('char' in item) {\n return <Text>{item.char[0]}</Text>\n } else if ('userInput' in item) {\n return <UserInput userInput={item.userInput} />\n } else if ('filePath' in item) {\n return <FilePath filePath={item.filePath} />\n } else if ('list' in item) {\n return <List {...item.list} />\n } else {\n const groupedItems = item.map(tokenToBlock).reduce(splitByDisplayType, [])\n\n return (\n <Box flexDirection=\"column\">\n {groupedItems.map((items, groupIndex) => {\n if (items[0]!.display === 'inline') {\n return (\n <Text key={groupIndex}>\n {items.map((item, itemIndex) => (\n <Text key={itemIndex}>\n {itemIndex !== 0 && !(typeof item.value !== 'string' && 'char' in item.value) && <Text> </Text>}\n <TokenizedText item={item.value} />\n </Text>\n ))}\n </Text>\n )\n } else {\n return <List key={groupIndex} items={(items[0]!.value as ListToken).list.items} />\n }\n })}\n </Box>\n )\n }\n}\n\nexport {TokenizedText}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TokenizedText } from './TokenizedText.js';
|
|
2
|
+
import { unstyled } from '../../../../output.js';
|
|
3
|
+
import { describe, expect, test } from 'vitest';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { render } from 'ink-testing-library';
|
|
6
|
+
describe('TokenizedText', async () => {
|
|
7
|
+
test('renders arrays of items separated by spaces', async () => {
|
|
8
|
+
const item = [
|
|
9
|
+
'Run',
|
|
10
|
+
{
|
|
11
|
+
command: 'cd verification-app',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
link: {
|
|
15
|
+
url: 'https://example.com',
|
|
16
|
+
label: 'Example',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
char: '!',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
userInput: 'my-app',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
list: {
|
|
27
|
+
items: ['Item 1', 'Item 2', 'Item 3'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
filePath: 'src/this/is/a/test.js',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
const { lastFrame } = render(React.createElement(TokenizedText, { item: item }));
|
|
35
|
+
expect(unstyled(lastFrame())).toMatchInlineSnapshot(`
|
|
36
|
+
"Run \`cd verification-app\` Example ( https://example.com )! my-app
|
|
37
|
+
• Item 1
|
|
38
|
+
• Item 2
|
|
39
|
+
• Item 3
|
|
40
|
+
\\"src/this/is/a/test.js\\""
|
|
41
|
+
`);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=TokenizedText.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenizedText.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TokenizedText.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,QAAQ,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;IACnC,IAAI,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,IAAI,GAAG;YACX,KAAK;YACL;gBACE,OAAO,EAAE,qBAAqB;aAC/B;YACD;gBACE,IAAI,EAAE;oBACJ,GAAG,EAAE,qBAAqB;oBAC1B,KAAK,EAAE,SAAS;iBACjB;aACF;YACD;gBACE,IAAI,EAAE,GAAG;aACV;YACD;gBACE,SAAS,EAAE,QAAQ;aACpB;YACD;gBACE,IAAI,EAAE;oBACJ,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;iBACtC;aACF;YACD;gBACE,QAAQ,EAAE,uBAAuB;aAClC;SACF,CAAA;QAED,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,aAAa,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,CAAA;QAEzD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;KAMpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {TokenizedText} from './TokenizedText.js'\nimport {unstyled} from '../../../../output.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\ndescribe('TokenizedText', async () => {\n test('renders arrays of items separated by spaces', async () => {\n const item = [\n 'Run',\n {\n command: 'cd verification-app',\n },\n {\n link: {\n url: 'https://example.com',\n label: 'Example',\n },\n },\n {\n char: '!',\n },\n {\n userInput: 'my-app',\n },\n {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n {\n filePath: 'src/this/is/a/test.js',\n },\n ]\n\n const {lastFrame} = render(<TokenizedText item={item} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"Run \\`cd verification-app\\` Example ( https://example.com )! my-app\n • Item 1\n • Item 2\n • Item 3\n \\\\\"src/this/is/a/test.js\\\\\"\"\n `)\n })\n})\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
userInput: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* `UserInput` displays some text that represents input from the user.
|
|
7
|
+
* For example an answer to a selection prompt.
|
|
8
|
+
*/
|
|
9
|
+
declare const UserInput: React.FC<Props>;
|
|
10
|
+
export { UserInput };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Text } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* `UserInput` displays some text that represents input from the user.
|
|
5
|
+
* For example an answer to a selection prompt.
|
|
6
|
+
*/
|
|
7
|
+
const UserInput = ({ userInput }) => {
|
|
8
|
+
return React.createElement(Text, { color: "cyan" }, userInput);
|
|
9
|
+
};
|
|
10
|
+
export { UserInput };
|
|
11
|
+
//# sourceMappingURL=UserInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserInput.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/UserInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB;;;GAGG;AACH,MAAM,SAAS,GAAoB,CAAC,EAAC,SAAS,EAAiC,EAAe,EAAE;IAC9F,OAAO,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM,IAAE,SAAS,CAAQ,CAAA;AAC9C,CAAC,CAAA;AAED,OAAO,EAAC,SAAS,EAAC,CAAA","sourcesContent":["import {Text} from 'ink'\nimport React from 'react'\n\ninterface Props {\n userInput: string\n}\n\n/**\n * `UserInput` displays some text that represents input from the user.\n * For example an answer to a selection prompt.\n */\nconst UserInput: React.FC<Props> = ({userInput}: React.PropsWithChildren<Props>): JSX.Element => {\n return <Text color=\"cyan\">{userInput}</Text>\n}\n\nexport {UserInput}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UserInput } from './UserInput.js';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { render } from 'ink-testing-library';
|
|
5
|
+
describe('UserInput', async () => {
|
|
6
|
+
test('renders correctly', async () => {
|
|
7
|
+
const { lastFrame } = render(React.createElement(UserInput, { userInput: "my-app" }));
|
|
8
|
+
expect(lastFrame()).toMatchInlineSnapshot('"[36mmy-app[39m"');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=UserInput.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserInput.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/UserInput.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,QAAQ,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE;IAC/B,IAAI,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;QACnC,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,GAAG,CAAC,CAAA;QAE5D,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAA;IACjE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {UserInput} from './UserInput.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\ndescribe('UserInput', async () => {\n test('renders correctly', async () => {\n const {lastFrame} = render(<UserInput userInput=\"my-app\" />)\n\n expect(lastFrame()).toMatchInlineSnapshot('\"\u001b[36mmy-app\u001b[39m\"')\n })\n})\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useApp } from 'ink';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
export default function useEffectAsync(asyncFunction, { onFulfilled = () => { }, onRejected = () => { } }) {
|
|
4
|
+
const { exit: unmountInk } = useApp();
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
asyncFunction()
|
|
7
|
+
.then(() => {
|
|
8
|
+
onFulfilled();
|
|
9
|
+
unmountInk();
|
|
10
|
+
})
|
|
11
|
+
.catch((error) => {
|
|
12
|
+
onRejected(error);
|
|
13
|
+
unmountInk(error);
|
|
14
|
+
});
|
|
15
|
+
}, []);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=use-async-and-unmount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-async-and-unmount.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/hooks/use-async-and-unmount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAA;AAO/B,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,aAAqC,EACrC,EAAC,WAAW,GAAG,GAAG,EAAE,GAAE,CAAC,EAAE,UAAU,GAAG,GAAG,EAAE,GAAE,CAAC,EAAU;IAExD,MAAM,EAAC,IAAI,EAAE,UAAU,EAAC,GAAG,MAAM,EAAE,CAAA;IAEnC,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,EAAE;aACZ,IAAI,CAAC,GAAG,EAAE;YACT,WAAW,EAAE,CAAA;YACb,UAAU,EAAE,CAAA;QACd,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,UAAU,CAAC,KAAK,CAAC,CAAA;YACjB,UAAU,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC,CAAC,CAAA;IACN,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC","sourcesContent":["import {useApp} from 'ink'\nimport {useEffect} from 'react'\n\ninterface Options {\n onFulfilled?: () => unknown\n onRejected?: (error: Error) => void\n}\n\nexport default function useEffectAsync(\n asyncFunction: () => Promise<unknown>,\n {onFulfilled = () => {}, onRejected = () => {}}: Options,\n) {\n const {exit: unmountInk} = useApp()\n\n useEffect(() => {\n asyncFunction()\n .then(() => {\n onFulfilled()\n unmountInk()\n })\n .catch((error) => {\n onRejected(error)\n unmountInk(error)\n })\n }, [])\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useStdout } from 'ink';
|
|
2
|
+
const MIN_WIDTH = 80;
|
|
3
|
+
export default function useLayout() {
|
|
4
|
+
const { stdout } = useStdout();
|
|
5
|
+
const fullWidth = stdout?.columns ?? MIN_WIDTH;
|
|
6
|
+
let oneThird;
|
|
7
|
+
let twoThirds;
|
|
8
|
+
if (fullWidth <= MIN_WIDTH) {
|
|
9
|
+
oneThird = fullWidth;
|
|
10
|
+
twoThirds = fullWidth;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
oneThird = column({ fullWidth, fraction: [1, 3], minWidth: MIN_WIDTH });
|
|
14
|
+
twoThirds = column({ fullWidth, fraction: [2, 3], minWidth: MIN_WIDTH });
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
twoThirds,
|
|
18
|
+
oneThird,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function column({ fullWidth, fraction, minWidth, }) {
|
|
22
|
+
const fractionedWidth = Math.floor((fullWidth / fraction[1]) * fraction[0]);
|
|
23
|
+
if (fractionedWidth < minWidth) {
|
|
24
|
+
return minWidth;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return fractionedWidth;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=use-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-layout.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/hooks/use-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,KAAK,CAAA;AAE7B,MAAM,SAAS,GAAG,EAAE,CAAA;AAOpB,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,MAAM,EAAC,MAAM,EAAC,GAAG,SAAS,EAAE,CAAA;IAE5B,MAAM,SAAS,GAAG,MAAM,EAAE,OAAO,IAAI,SAAS,CAAA;IAC9C,IAAI,QAAQ,CAAA;IACZ,IAAI,SAAS,CAAA;IAEb,IAAI,SAAS,IAAI,SAAS,EAAE;QAC1B,QAAQ,GAAG,SAAS,CAAA;QACpB,SAAS,GAAG,SAAS,CAAA;KACtB;SAAM;QACL,QAAQ,GAAG,MAAM,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAC,CAAC,CAAA;QACrE,SAAS,GAAG,MAAM,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAC,CAAC,CAAA;KACvE;IAED,OAAO;QACL,SAAS;QACT,QAAQ;KACT,CAAA;AACH,CAAC;AAED,SAAS,MAAM,CAAC,EACd,SAAS,EACT,QAAQ,EACR,QAAQ,GAKT;IACC,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAE3E,IAAI,eAAe,GAAG,QAAQ,EAAE;QAC9B,OAAO,QAAQ,CAAA;KAChB;SAAM;QACL,OAAO,eAAe,CAAA;KACvB;AACH,CAAC","sourcesContent":["import {useStdout} from 'ink'\n\nconst MIN_WIDTH = 80\n\ninterface Layout {\n twoThirds: number\n oneThird: number\n}\n\nexport default function useLayout(): Layout {\n const {stdout} = useStdout()\n\n const fullWidth = stdout?.columns ?? MIN_WIDTH\n let oneThird\n let twoThirds\n\n if (fullWidth <= MIN_WIDTH) {\n oneThird = fullWidth\n twoThirds = fullWidth\n } else {\n oneThird = column({fullWidth, fraction: [1, 3], minWidth: MIN_WIDTH})\n twoThirds = column({fullWidth, fraction: [2, 3], minWidth: MIN_WIDTH})\n }\n\n return {\n twoThirds,\n oneThird,\n }\n}\n\nfunction column({\n fullWidth,\n fraction,\n minWidth,\n}: {\n fullWidth: number\n fraction: [number, number]\n minWidth: number\n}): number {\n const fractionedWidth = Math.floor((fullWidth / fraction[1]) * fraction[0])\n\n if (fractionedWidth < minWidth) {\n return minWidth\n } else {\n return fractionedWidth\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Logger, LogLevel } from '../../output.js';
|
|
3
|
+
import { ReactElement } from 'react';
|
|
4
|
+
import { Key, RenderOptions } from 'ink';
|
|
5
|
+
import { EventEmitter } from 'events';
|
|
6
|
+
export declare function renderOnce(element: JSX.Element, logLevel?: LogLevel, logger?: Logger): void;
|
|
7
|
+
export declare function render(element: JSX.Element, options?: RenderOptions): Promise<void>;
|
|
8
|
+
interface Instance {
|
|
9
|
+
output: string | undefined;
|
|
10
|
+
unmount: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare class OutputStream extends EventEmitter {
|
|
13
|
+
columns: number;
|
|
14
|
+
private _lastFrame?;
|
|
15
|
+
constructor(options: {
|
|
16
|
+
columns: number;
|
|
17
|
+
});
|
|
18
|
+
write: (frame: string) => void;
|
|
19
|
+
lastFrame: () => string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export declare const renderString: (element: ReactElement) => Instance;
|
|
22
|
+
export declare function handleCtrlC(input: string, key: Key): void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isUnitTest } from '../../environment/local.js';
|
|
2
|
+
import { collectLog, consoleLog, outputWhereAppropriate } from '../../output.js';
|
|
3
|
+
import { render as inkRender } from 'ink';
|
|
4
|
+
import { EventEmitter } from 'events';
|
|
5
|
+
export function renderOnce(element, logLevel = 'info', logger = consoleLog) {
|
|
6
|
+
const { output, unmount } = renderString(element);
|
|
7
|
+
if (output) {
|
|
8
|
+
if (isUnitTest())
|
|
9
|
+
collectLog(logLevel, output);
|
|
10
|
+
outputWhereAppropriate(logLevel, logger, output);
|
|
11
|
+
}
|
|
12
|
+
unmount();
|
|
13
|
+
}
|
|
14
|
+
export function render(element, options) {
|
|
15
|
+
const { waitUntilExit } = inkRender(element, options);
|
|
16
|
+
return waitUntilExit();
|
|
17
|
+
}
|
|
18
|
+
export class OutputStream extends EventEmitter {
|
|
19
|
+
constructor(options) {
|
|
20
|
+
super();
|
|
21
|
+
this.write = (frame) => {
|
|
22
|
+
this._lastFrame = frame;
|
|
23
|
+
};
|
|
24
|
+
this.lastFrame = () => {
|
|
25
|
+
return this._lastFrame;
|
|
26
|
+
};
|
|
27
|
+
this.columns = options.columns;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export const renderString = (element) => {
|
|
31
|
+
const stdout = new OutputStream({ columns: process.stdout.columns });
|
|
32
|
+
const stderr = new OutputStream({ columns: process.stderr.columns });
|
|
33
|
+
const instance = inkRender(element, {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
stdout: stdout,
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
|
+
stderr: stderr,
|
|
38
|
+
debug: true,
|
|
39
|
+
exitOnCtrlC: false,
|
|
40
|
+
patchConsole: false,
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
output: stdout.lastFrame(),
|
|
44
|
+
unmount: instance.unmount,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export function handleCtrlC(input, key) {
|
|
48
|
+
if (input === 'c' && key.ctrl) {
|
|
49
|
+
// Exceptions thrown in hooks aren't caught by our errorHandler.
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/private/node/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAC,UAAU,EAAE,UAAU,EAAoB,sBAAsB,EAAC,MAAM,iBAAiB,CAAA;AAEhG,OAAO,EAAM,MAAM,IAAI,SAAS,EAAgB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAA;AAEnC,MAAM,UAAU,UAAU,CAAC,OAAoB,EAAE,WAAqB,MAAM,EAAE,SAAiB,UAAU;IACvG,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IAE/C,IAAI,MAAM,EAAE;QACV,IAAI,UAAU,EAAE;YAAE,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC9C,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KACjD;IAED,OAAO,EAAE,CAAA;AACX,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAoB,EAAE,OAAuB;IAClE,MAAM,EAAC,aAAa,EAAC,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACnD,OAAO,aAAa,EAAE,CAAA;AACxB,CAAC;AAOD,MAAM,OAAO,YAAa,SAAQ,YAAY;IAI5C,YAAY,OAA0B;QACpC,KAAK,EAAE,CAAA;QAIT,UAAK,GAAG,CAAC,KAAa,EAAE,EAAE;YACxB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;QACzB,CAAC,CAAA;QAED,cAAS,GAAG,GAAG,EAAE;YACf,OAAO,IAAI,CAAC,UAAU,CAAA;QACxB,CAAC,CAAA;QATC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;IAChC,CAAC;CASF;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAqB,EAAY,EAAE;IAC9D,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,EAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAC,CAAC,CAAA;IAClE,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,EAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAC,CAAC,CAAA;IAElE,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,EAAE;QAClC,8DAA8D;QAC9D,MAAM,EAAE,MAAa;QACrB,8DAA8D;QAC9D,MAAM,EAAE,MAAa;QACrB,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAA;IAEF,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE;QAC1B,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,GAAQ;IACjD,IAAI,KAAK,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE;QAC7B,gEAAgE;QAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;AACH,CAAC","sourcesContent":["import {isUnitTest} from '../../environment/local.js'\nimport {collectLog, consoleLog, Logger, LogLevel, outputWhereAppropriate} from '../../output.js'\nimport {ReactElement} from 'react'\nimport {Key, render as inkRender, RenderOptions} from 'ink'\nimport {EventEmitter} from 'events'\n\nexport function renderOnce(element: JSX.Element, logLevel: LogLevel = 'info', logger: Logger = consoleLog) {\n const {output, unmount} = renderString(element)\n\n if (output) {\n if (isUnitTest()) collectLog(logLevel, output)\n outputWhereAppropriate(logLevel, logger, output)\n }\n\n unmount()\n}\n\nexport function render(element: JSX.Element, options?: RenderOptions) {\n const {waitUntilExit} = inkRender(element, options)\n return waitUntilExit()\n}\n\ninterface Instance {\n output: string | undefined\n unmount: () => void\n}\n\nexport class OutputStream extends EventEmitter {\n columns: number\n private _lastFrame?: string\n\n constructor(options: {columns: number}) {\n super()\n this.columns = options.columns\n }\n\n write = (frame: string) => {\n this._lastFrame = frame\n }\n\n lastFrame = () => {\n return this._lastFrame\n }\n}\n\nexport const renderString = (element: ReactElement): Instance => {\n const stdout = new OutputStream({columns: process.stdout.columns})\n const stderr = new OutputStream({columns: process.stderr.columns})\n\n const instance = inkRender(element, {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stdout: stdout as any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stderr: stderr as any,\n debug: true,\n exitOnCtrlC: false,\n patchConsole: false,\n })\n\n return {\n output: stdout.lastFrame(),\n unmount: instance.unmount,\n }\n}\n\nexport function handleCtrlC(input: string, key: Key) {\n if (input === 'c' && key.ctrl) {\n // Exceptions thrown in hooks aren't caught by our errorHandler.\n process.exit(1)\n }\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { List, ValueIteratee } from 'lodash';
|
|
2
|
+
/**
|
|
3
|
+
* Takes a random value from an array.
|
|
4
|
+
* @param array - Array from which we'll select a random item.
|
|
5
|
+
* @returns A random element from the array.
|
|
6
|
+
*/
|
|
7
|
+
export declare function takeRandomFromArray<T>(array: T[]): T;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a copy of the array deleting the elemements that are undefined.
|
|
10
|
+
* @param array - The array whose undefined will be deleted.
|
|
11
|
+
* @returns A copy of the array with the undefined elements deleted.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getArrayRejectingUndefined<T>(array: (T | undefined)[]): T[];
|
|
14
|
+
/**
|
|
15
|
+
* Returns true if an array contains duplicates.
|
|
16
|
+
* @returns True if the array contains duplicates.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getArrayContainsDuplicates<T>(array: T[]): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* This method is like `_.uniq` except that it accepts `iteratee` which is
|
|
21
|
+
* invoked for each element in `array` to generate the criterion by which
|
|
22
|
+
* uniqueness is computed. The iteratee is invoked with one argument: (value).
|
|
23
|
+
*
|
|
24
|
+
* @param array - The array to inspect.
|
|
25
|
+
* @param iteratee - The iteratee invoked per element.
|
|
26
|
+
* @returns Returns the new duplicate free array.
|
|
27
|
+
*/
|
|
28
|
+
export declare function uniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
|
|
29
|
+
/**
|
|
30
|
+
* Creates an array of `array` values not included in the other provided arrays using SameValueZero for
|
|
31
|
+
* equality comparisons. The order and references of result values are determined by the first array.
|
|
32
|
+
*
|
|
33
|
+
* @param array - The array to inspect.
|
|
34
|
+
* @param values - The arrays of values to exclude.
|
|
35
|
+
* @returns Returns the new array of filtered values.
|
|
36
|
+
*/
|
|
37
|
+
export declare function difference<T>(array: List<T> | null | undefined, ...values: List<T>[]): T[];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* Takes a random value from an array.
|
|
5
|
+
* @param array - Array from which we'll select a random item.
|
|
6
|
+
* @returns A random element from the array.
|
|
7
|
+
*/
|
|
8
|
+
export function takeRandomFromArray(array) {
|
|
9
|
+
return array[Math.floor(Math.random() * array.length)];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns a copy of the array deleting the elemements that are undefined.
|
|
13
|
+
* @param array - The array whose undefined will be deleted.
|
|
14
|
+
* @returns A copy of the array with the undefined elements deleted.
|
|
15
|
+
*/
|
|
16
|
+
export function getArrayRejectingUndefined(array) {
|
|
17
|
+
return array.filter((item) => item !== undefined);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns true if an array contains duplicates.
|
|
21
|
+
* @returns True if the array contains duplicates.
|
|
22
|
+
*/
|
|
23
|
+
export function getArrayContainsDuplicates(array) {
|
|
24
|
+
return array.length !== new Set(array).size;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* This method is like `_.uniq` except that it accepts `iteratee` which is
|
|
28
|
+
* invoked for each element in `array` to generate the criterion by which
|
|
29
|
+
* uniqueness is computed. The iteratee is invoked with one argument: (value).
|
|
30
|
+
*
|
|
31
|
+
* @param array - The array to inspect.
|
|
32
|
+
* @param iteratee - The iteratee invoked per element.
|
|
33
|
+
* @returns Returns the new duplicate free array.
|
|
34
|
+
*/
|
|
35
|
+
export function uniqBy(array, iteratee) {
|
|
36
|
+
const lodashUniqBy = require('lodash/uniqBy');
|
|
37
|
+
return lodashUniqBy(array, iteratee);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates an array of `array` values not included in the other provided arrays using SameValueZero for
|
|
41
|
+
* equality comparisons. The order and references of result values are determined by the first array.
|
|
42
|
+
*
|
|
43
|
+
* @param array - The array to inspect.
|
|
44
|
+
* @param values - The arrays of values to exclude.
|
|
45
|
+
* @returns Returns the new array of filtered values.
|
|
46
|
+
*/
|
|
47
|
+
export function difference(array, ...values) {
|
|
48
|
+
const lodashDifference = require('lodash/difference');
|
|
49
|
+
return lodashDifference(array, ...values);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/public/common/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAGpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAI,KAAU;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAE,CAAA;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAwB;IACpE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAmC,CAAA;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAU;IACtD,OAAO,KAAK,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAA;AAC7C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAAI,KAAiC,EAAE,QAA0B;IACrF,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAC7C,OAAO,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAI,KAAiC,EAAE,GAAG,MAAiB;IACnF,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACrD,OAAO,gBAAgB,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import {createRequire} from 'module'\nimport type {List, ValueIteratee} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Takes a random value from an array.\n * @param array - Array from which we'll select a random item.\n * @returns A random element from the array.\n */\nexport function takeRandomFromArray<T>(array: T[]): T {\n return array[Math.floor(Math.random() * array.length)]!\n}\n\n/**\n * Returns a copy of the array deleting the elemements that are undefined.\n * @param array - The array whose undefined will be deleted.\n * @returns A copy of the array with the undefined elements deleted.\n */\nexport function getArrayRejectingUndefined<T>(array: (T | undefined)[]): T[] {\n return array.filter((item) => item !== undefined) as Exclude<T, null | undefined>[]\n}\n\n/**\n * Returns true if an array contains duplicates.\n * @returns True if the array contains duplicates.\n */\nexport function getArrayContainsDuplicates<T>(array: T[]): boolean {\n return array.length !== new Set(array).size\n}\n\n/**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The iteratee is invoked with one argument: (value).\n *\n * @param array - The array to inspect.\n * @param iteratee - The iteratee invoked per element.\n * @returns Returns the new duplicate free array.\n */\nexport function uniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[] {\n const lodashUniqBy = require('lodash/uniqBy')\n return lodashUniqBy(array, iteratee)\n}\n\n/**\n * Creates an array of `array` values not included in the other provided arrays using SameValueZero for\n * equality comparisons. The order and references of result values are determined by the first array.\n *\n * @param array - The array to inspect.\n * @param values - The arrays of values to exclude.\n * @returns Returns the new array of filtered values.\n */\nexport function difference<T>(array: List<T> | null | undefined, ...values: List<T>[]): T[] {\n const lodashDifference = require('lodash/difference')\n return lodashDifference(array, ...values)\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { List, ValueIteratee } from 'lodash';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an object composed of keys generated from the results of running each element of collection through
|
|
4
|
+
* iteratee. The corresponding value of each key is an array of the elements responsible for generating the
|
|
5
|
+
* key. The iteratee is invoked with one argument: (value).
|
|
6
|
+
*
|
|
7
|
+
* @param collection - The collection to iterate over.
|
|
8
|
+
* @param iteratee - The function invoked per iteration.
|
|
9
|
+
* @returns Returns the composed aggregate object.
|
|
10
|
+
*/
|
|
11
|
+
export declare function groupBy<T>(collection: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): {
|
|
12
|
+
[index: string]: T[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,
|
|
16
|
+
* while the second of which contains elements predicate returns falsey for.
|
|
17
|
+
* The predicate is invoked with three arguments: (value, index|key, collection).
|
|
18
|
+
*
|
|
19
|
+
* @param collection - The collection to iterate over.
|
|
20
|
+
* @param callback - The function called per iteration.
|
|
21
|
+
* @returns Returns the array of grouped elements.
|
|
22
|
+
*/
|
|
23
|
+
export declare function partition<T>(collection: List<T> | null | undefined, callback: ValueIteratee<T>): [T[], T[]];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* Creates an object composed of keys generated from the results of running each element of collection through
|
|
5
|
+
* iteratee. The corresponding value of each key is an array of the elements responsible for generating the
|
|
6
|
+
* key. The iteratee is invoked with one argument: (value).
|
|
7
|
+
*
|
|
8
|
+
* @param collection - The collection to iterate over.
|
|
9
|
+
* @param iteratee - The function invoked per iteration.
|
|
10
|
+
* @returns Returns the composed aggregate object.
|
|
11
|
+
*/
|
|
12
|
+
export function groupBy(collection, iteratee) {
|
|
13
|
+
const lodashBroupBy = require('lodash/groupBy');
|
|
14
|
+
return lodashBroupBy(collection, iteratee);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,
|
|
18
|
+
* while the second of which contains elements predicate returns falsey for.
|
|
19
|
+
* The predicate is invoked with three arguments: (value, index|key, collection).
|
|
20
|
+
*
|
|
21
|
+
* @param collection - The collection to iterate over.
|
|
22
|
+
* @param callback - The function called per iteration.
|
|
23
|
+
* @returns Returns the array of grouped elements.
|
|
24
|
+
*/
|
|
25
|
+
export function partition(collection, callback) {
|
|
26
|
+
const lodashPartition = require('lodash/partition');
|
|
27
|
+
return lodashPartition(collection, callback);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/public/common/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAGpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CACrB,UAA2C,EAC3C,QAA2B;IAI3B,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC/C,OAAO,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;AAC5C,CAAC;AAED;;;;;;;;GAQG;AAEH,MAAM,UAAU,SAAS,CAAI,UAAsC,EAAE,QAA0B;IAC7F,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACnD,OAAO,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;AAC9C,CAAC","sourcesContent":["import {createRequire} from 'module'\nimport type {List, ValueIteratee} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Creates an object composed of keys generated from the results of running each element of collection through\n * iteratee. The corresponding value of each key is an array of the elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @param collection - The collection to iterate over.\n * @param iteratee - The function invoked per iteration.\n * @returns Returns the composed aggregate object.\n */\nexport function groupBy<T>(\n collection: ArrayLike<T> | null | undefined,\n iteratee?: ValueIteratee<T>,\n): {\n [index: string]: T[]\n} {\n const lodashBroupBy = require('lodash/groupBy')\n return lodashBroupBy(collection, iteratee)\n}\n\n/**\n * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,\n * while the second of which contains elements predicate returns falsey for.\n * The predicate is invoked with three arguments: (value, index|key, collection).\n *\n * @param collection - The collection to iterate over.\n * @param callback - The function called per iteration.\n * @returns Returns the array of grouped elements.\n */\n\nexport function partition<T>(collection: List<T> | null | undefined, callback: ValueIteratee<T>): [T[], T[]] {\n const lodashPartition = require('lodash/partition')\n return lodashPartition(collection, callback)\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DebouncedFunc, DebounceSettings } from 'lodash';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for
|
|
4
|
+
* storing the result based on the arguments provided to the memoized function. By default, the first argument
|
|
5
|
+
* provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with
|
|
6
|
+
* the this binding of the memoized function.
|
|
7
|
+
*
|
|
8
|
+
* @param func - The function to have its output memoized.
|
|
9
|
+
* @param resolver - The function to resolve the cache key.
|
|
10
|
+
* @returns Returns the new memoizing function.
|
|
11
|
+
*/
|
|
12
|
+
export declare function memoize<T extends (...args: any) => any>(func: T, resolver?: (...args: Parameters<T>) => unknown): T;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since
|
|
15
|
+
* the last time the debounced function was invoked. The debounced function comes with a cancel method to
|
|
16
|
+
* cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to
|
|
17
|
+
* indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent
|
|
18
|
+
* calls to the debounced function return the result of the last func invocation.
|
|
19
|
+
*
|
|
20
|
+
* Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only
|
|
21
|
+
* if the the debounced function is invoked more than once during the wait timeout.
|
|
22
|
+
*
|
|
23
|
+
* See David Corbacho’s article for details over the differences between _.debounce and _.throttle.
|
|
24
|
+
*
|
|
25
|
+
* @param func - The function to debounce.
|
|
26
|
+
* @param wait - The number of milliseconds to delay.
|
|
27
|
+
* @param options - The options object.
|
|
28
|
+
* @returns Returns the new debounced function.
|
|
29
|
+
*/
|
|
30
|
+
export declare function debounce<T extends (...args: any) => any>(func: T, wait?: number, options?: DebounceSettings): DebouncedFunc<T>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for
|
|
5
|
+
* storing the result based on the arguments provided to the memoized function. By default, the first argument
|
|
6
|
+
* provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with
|
|
7
|
+
* the this binding of the memoized function.
|
|
8
|
+
*
|
|
9
|
+
* @param func - The function to have its output memoized.
|
|
10
|
+
* @param resolver - The function to resolve the cache key.
|
|
11
|
+
* @returns Returns the new memoizing function.
|
|
12
|
+
*/
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
export function memoize(func, resolver) {
|
|
15
|
+
const memoize = require('lodash/memoize');
|
|
16
|
+
return memoize(func, resolver);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since
|
|
20
|
+
* the last time the debounced function was invoked. The debounced function comes with a cancel method to
|
|
21
|
+
* cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to
|
|
22
|
+
* indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent
|
|
23
|
+
* calls to the debounced function return the result of the last func invocation.
|
|
24
|
+
*
|
|
25
|
+
* Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only
|
|
26
|
+
* if the the debounced function is invoked more than once during the wait timeout.
|
|
27
|
+
*
|
|
28
|
+
* See David Corbacho’s article for details over the differences between _.debounce and _.throttle.
|
|
29
|
+
*
|
|
30
|
+
* @param func - The function to debounce.
|
|
31
|
+
* @param wait - The number of milliseconds to delay.
|
|
32
|
+
* @param options - The options object.
|
|
33
|
+
* @returns Returns the new debounced function.
|
|
34
|
+
*/
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
export function debounce(func, wait, options) {
|
|
37
|
+
const lodashDebounce = require('lodash/debounce');
|
|
38
|
+
return lodashDebounce(func, wait, options);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/public/common/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAGpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;;GASG;AACH,8DAA8D;AAC9D,MAAM,UAAU,OAAO,CAAkC,IAAO,EAAE,QAA8C;IAC9G,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACzC,OAAO,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,8DAA8D;AAC9D,MAAM,UAAU,QAAQ,CACtB,IAAO,EACP,IAAa,EACb,OAA0B;IAE1B,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACjD,OAAO,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;AAC5C,CAAC","sourcesContent":["import {createRequire} from 'module'\nimport type {DebouncedFunc, DebounceSettings} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for\n * storing the result based on the arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with\n * the this binding of the memoized function.\n *\n * @param func - The function to have its output memoized.\n * @param resolver - The function to resolve the cache key.\n * @returns Returns the new memoizing function.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function memoize<T extends (...args: any) => any>(func: T, resolver?: (...args: Parameters<T>) => unknown): T {\n const memoize = require('lodash/memoize')\n return memoize(func, resolver)\n}\n\n/**\n * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since\n * the last time the debounced function was invoked. The debounced function comes with a cancel method to\n * cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to\n * indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent\n * calls to the debounced function return the result of the last func invocation.\n *\n * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only\n * if the the debounced function is invoked more than once during the wait timeout.\n *\n * See David Corbacho’s article for details over the differences between _.debounce and _.throttle.\n *\n * @param func - The function to debounce.\n * @param wait - The number of milliseconds to delay.\n * @param options - The options object.\n * @returns Returns the new debounced function.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function debounce<T extends (...args: any) => any>(\n func: T,\n wait?: number,\n options?: DebounceSettings,\n): DebouncedFunc<T> {\n const lodashDebounce = require('lodash/debounce')\n return lodashDebounce(func, wait, options)\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performs a deep comparison between two values to determine if they are
|
|
3
|
+
* equivalent.
|
|
4
|
+
*
|
|
5
|
+
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
6
|
+
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
7
|
+
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
8
|
+
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
9
|
+
* nodes are **not** supported.
|
|
10
|
+
*
|
|
11
|
+
* @param value - The value to compare.
|
|
12
|
+
* @param other - The other value to compare.
|
|
13
|
+
* @returns Returns `true` if the values are equivalent, else `false`.
|
|
14
|
+
* @example
|
|
15
|
+
*/
|
|
16
|
+
export declare function isEqual(value: unknown, other: unknown): boolean;
|