@shopify/cli-kit 3.91.1 → 3.92.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/private/node/analytics/bounded-collections.d.ts +1 -3
- package/dist/private/node/analytics/bounded-collections.js.map +1 -1
- package/dist/private/node/analytics/error-categorizer.js.map +1 -1
- package/dist/private/node/analytics.js.map +1 -1
- package/dist/private/node/api/graphql.d.ts +1 -3
- package/dist/private/node/api/graphql.js.map +1 -1
- package/dist/private/node/api/headers.d.ts +2 -6
- package/dist/private/node/api/headers.js +0 -1
- package/dist/private/node/api/headers.js.map +1 -1
- package/dist/private/node/api/rest.d.ts +2 -6
- package/dist/private/node/api/rest.js.map +1 -1
- package/dist/private/node/api.js.map +1 -1
- package/dist/private/node/conf-store.d.ts +6 -6
- package/dist/private/node/conf-store.js +13 -6
- package/dist/private/node/conf-store.js.map +1 -1
- package/dist/private/node/session/device-authorization.js.map +1 -1
- package/dist/private/node/session/exchange.d.ts +1 -19
- package/dist/private/node/session/exchange.js +13 -30
- package/dist/private/node/session/exchange.js.map +1 -1
- package/dist/private/node/session/schema.d.ts +62 -62
- package/dist/private/node/session/store.js +1 -1
- package/dist/private/node/session/store.js.map +1 -1
- package/dist/private/node/session/validate.d.ts +4 -5
- package/dist/private/node/session/validate.js +7 -35
- package/dist/private/node/session/validate.js.map +1 -1
- package/dist/private/node/session.js +18 -65
- package/dist/private/node/session.js.map +1 -1
- package/dist/private/node/testing/ui.d.ts +2 -1
- package/dist/private/node/testing/ui.js +22 -24
- package/dist/private/node/testing/ui.js.map +1 -1
- package/dist/private/node/themes/generate-theme-name.js +0 -1
- package/dist/private/node/themes/generate-theme-name.js.map +1 -1
- package/dist/private/node/ui/alert.js.map +1 -1
- package/dist/private/node/ui/components/Alert.test.js +2 -4
- package/dist/private/node/ui/components/Alert.test.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.js +6 -1
- package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.test.js +2 -3
- package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Banner.js +0 -1
- package/dist/private/node/ui/components/Banner.js.map +1 -1
- package/dist/private/node/ui/components/Banner.test.js +2 -2
- package/dist/private/node/ui/components/Banner.test.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.js +4 -2
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.test.js +9 -3
- package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.js.map +1 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.js +0 -1
- package/dist/private/node/ui/components/FatalError.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
- package/dist/private/node/ui/components/List.test.js.map +1 -1
- package/dist/private/node/ui/components/LoadingBar.js.map +1 -1
- package/dist/private/node/ui/components/LoadingBar.test.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/InfoTable.d.ts +1 -3
- package/dist/private/node/ui/components/Prompts/InfoTable.js +0 -1
- package/dist/private/node/ui/components/Prompts/InfoTable.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/InfoTable.test.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.d.ts +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.js +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.test.js +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.d.ts +4 -5
- package/dist/private/node/ui/components/SelectInput.js +5 -7
- package/dist/private/node/ui/components/SelectInput.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.js +0 -1
- package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js +0 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/SingleTask.js.map +1 -1
- package/dist/private/node/ui/components/SingleTask.test.js.map +1 -1
- package/dist/private/node/ui/components/Table/ScalarDict.d.ts +2 -4
- package/dist/private/node/ui/components/Table/ScalarDict.js.map +1 -1
- package/dist/private/node/ui/components/Table/Table.js +0 -1
- package/dist/private/node/ui/components/Table/Table.js.map +1 -1
- package/dist/private/node/ui/components/Table/Table.test.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.js +0 -2
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.test.js +2 -6
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
- package/dist/private/node/ui/components/TextAnimation.test.js +1 -1
- package/dist/private/node/ui/components/TextAnimation.test.js.map +1 -1
- package/dist/private/node/ui/components/TextInput.js +19 -19
- package/dist/private/node/ui/components/TextInput.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.js +1 -1
- package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.test.js +0 -1
- package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.js +1 -2
- package/dist/private/node/ui/components/TokenizedText.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
- package/dist/private/node/ui/contexts/LinksContext.d.ts +1 -3
- package/dist/private/node/ui/contexts/LinksContext.js.map +1 -1
- package/dist/private/node/ui/hooks/use-abort-signal.js +9 -1
- package/dist/private/node/ui/hooks/use-abort-signal.js.map +1 -1
- package/dist/private/node/ui.js +8 -1
- package/dist/private/node/ui.js.map +1 -1
- package/dist/public/common/array.js +0 -1
- package/dist/public/common/array.js.map +1 -1
- package/dist/public/common/collection.d.ts +1 -3
- package/dist/public/common/collection.js.map +1 -1
- package/dist/public/common/string.js +1 -4
- package/dist/public/common/string.js.map +1 -1
- package/dist/public/common/ts/json-narrowing.d.ts +1 -3
- package/dist/public/common/ts/json-narrowing.js.map +1 -1
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/analytics.js +1 -1
- package/dist/public/node/analytics.js.map +1 -1
- package/dist/public/node/api/admin.d.ts +2 -6
- package/dist/public/node/api/admin.js +1 -2
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/app-dev.d.ts +1 -1
- package/dist/public/node/api/app-dev.js +1 -1
- package/dist/public/node/api/app-dev.js.map +1 -1
- package/dist/public/node/api/app-management.d.ts +1 -3
- package/dist/public/node/api/app-management.js +1 -1
- package/dist/public/node/api/app-management.js.map +1 -1
- package/dist/public/node/api/business-platform.js.map +1 -1
- package/dist/public/node/api/functions.js +1 -1
- package/dist/public/node/api/functions.js.map +1 -1
- package/dist/public/node/api/graphql.d.ts +4 -12
- package/dist/public/node/api/graphql.js.map +1 -1
- package/dist/public/node/api/partners.js +1 -1
- package/dist/public/node/api/partners.js.map +1 -1
- package/dist/public/node/api/rest-api-throttler.js +0 -1
- package/dist/public/node/api/rest-api-throttler.js.map +1 -1
- package/dist/public/node/archiver.js +2 -2
- package/dist/public/node/archiver.js.map +1 -1
- package/dist/public/node/base-command.js +0 -2
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/cli.js.map +1 -1
- package/dist/public/node/context/local.js.map +1 -1
- package/dist/public/node/custom-oclif-loader.js +0 -1
- package/dist/public/node/custom-oclif-loader.js.map +1 -1
- package/dist/public/node/doctor/framework.d.ts +14 -9
- package/dist/public/node/doctor/framework.js +10 -3
- package/dist/public/node/doctor/framework.js.map +1 -1
- package/dist/public/node/doctor/reporter.d.ts +23 -0
- package/dist/public/node/doctor/reporter.js +33 -1
- package/dist/public/node/doctor/reporter.js.map +1 -1
- package/dist/public/node/dot-env.d.ts +2 -6
- package/dist/public/node/dot-env.js +1 -2
- package/dist/public/node/dot-env.js.map +1 -1
- package/dist/public/node/environments.d.ts +1 -3
- package/dist/public/node/environments.js.map +1 -1
- package/dist/public/node/error-handler.js +3 -3
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/error.d.ts +1 -1
- package/dist/public/node/error.js +2 -2
- package/dist/public/node/error.js.map +1 -1
- package/dist/public/node/framework.js +0 -1
- package/dist/public/node/framework.js.map +1 -1
- package/dist/public/node/fs.d.ts +1 -1
- package/dist/public/node/fs.js +1 -1
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/git.d.ts +1 -3
- package/dist/public/node/git.js +1 -3
- package/dist/public/node/git.js.map +1 -1
- package/dist/public/node/github.js +14 -8
- package/dist/public/node/github.js.map +1 -1
- package/dist/public/node/hooks/postrun.js +2 -2
- package/dist/public/node/hooks/postrun.js.map +1 -1
- package/dist/public/node/hooks/prerun.js +2 -2
- package/dist/public/node/hooks/prerun.js.map +1 -1
- package/dist/public/node/http.js +2 -3
- package/dist/public/node/http.js.map +1 -1
- package/dist/public/node/json-schema.d.ts +1 -3
- package/dist/public/node/json-schema.js +0 -1
- package/dist/public/node/json-schema.js.map +1 -1
- package/dist/public/node/liquid.js +1 -1
- package/dist/public/node/liquid.js.map +1 -1
- package/dist/public/node/local-storage.d.ts +1 -3
- package/dist/public/node/local-storage.js.map +1 -1
- package/dist/public/node/metadata.d.ts +1 -3
- package/dist/public/node/metadata.js +0 -1
- package/dist/public/node/metadata.js.map +1 -1
- package/dist/public/node/mimes.d.ts +1 -3
- package/dist/public/node/mimes.js.map +1 -1
- package/dist/public/node/monorail.js +1 -1
- package/dist/public/node/monorail.js.map +1 -1
- package/dist/public/node/multiple-installation-warning.d.ts +1 -3
- package/dist/public/node/multiple-installation-warning.js.map +1 -1
- package/dist/public/node/node-package-manager.d.ts +9 -27
- package/dist/public/node/node-package-manager.js +1 -1
- package/dist/public/node/node-package-manager.js.map +1 -1
- package/dist/public/node/os.js +1 -1
- package/dist/public/node/os.js.map +1 -1
- package/dist/public/node/output.d.ts +1 -3
- package/dist/public/node/output.js +1 -2
- package/dist/public/node/output.js.map +1 -1
- package/dist/public/node/path.d.ts +13 -0
- package/dist/public/node/path.js +10 -1
- package/dist/public/node/path.js.map +1 -1
- package/dist/public/node/plugins/tunnel.d.ts +5 -11
- package/dist/public/node/plugins/tunnel.js.map +1 -1
- package/dist/public/node/plugins.d.ts +4 -12
- package/dist/public/node/plugins.js.map +1 -1
- package/dist/public/node/result.js +1 -1
- package/dist/public/node/result.js.map +1 -1
- package/dist/public/node/session.js +15 -7
- package/dist/public/node/session.js.map +1 -1
- package/dist/public/node/system.d.ts +1 -3
- package/dist/public/node/system.js +1 -1
- package/dist/public/node/system.js.map +1 -1
- package/dist/public/node/tcp.js +1 -1
- package/dist/public/node/tcp.js.map +1 -1
- package/dist/public/node/testing/output.js +1 -1
- package/dist/public/node/testing/output.js.map +1 -1
- package/dist/public/node/themes/api.js +2 -2
- package/dist/public/node/themes/api.js.map +1 -1
- package/dist/public/node/themes/conf.d.ts +1 -3
- package/dist/public/node/themes/conf.js.map +1 -1
- package/dist/public/node/tree-kill.js +0 -1
- package/dist/public/node/tree-kill.js.map +1 -1
- package/dist/public/node/ui.js +0 -12
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/vendor/dev_server/dev-server-2016.d.ts +8 -0
- package/dist/public/node/vendor/dev_server/dev-server-2016.js +10 -2
- package/dist/public/node/vendor/dev_server/dev-server-2016.js.map +1 -1
- package/dist/public/node/vendor/dev_server/dev-server-2024.d.ts +8 -0
- package/dist/public/node/vendor/dev_server/dev-server-2024.js +10 -2
- package/dist/public/node/vendor/dev_server/dev-server-2024.js.map +1 -1
- package/dist/public/node/vendor/dev_server/dev-server.js +1 -1
- package/dist/public/node/vendor/dev_server/dev-server.js.map +1 -1
- package/dist/public/node/vendor/dev_server/env.d.ts +3 -0
- package/dist/public/node/vendor/dev_server/env.js +3 -0
- package/dist/public/node/vendor/dev_server/env.js.map +1 -1
- package/dist/public/node/vendor/dev_server/network/host.d.ts +7 -0
- package/dist/public/node/vendor/dev_server/network/host.js +7 -1
- package/dist/public/node/vendor/dev_server/network/host.js.map +1 -1
- package/dist/public/node/vendor/dev_server/network/index.d.ts +7 -0
- package/dist/public/node/vendor/dev_server/network/index.js +7 -2
- package/dist/public/node/vendor/dev_server/network/index.js.map +1 -1
- package/dist/public/node/vendor/otel-js/export/InstantaneousMetricReader.d.ts +1 -1
- package/dist/public/node/vendor/otel-js/export/InstantaneousMetricReader.js +2 -4
- package/dist/public/node/vendor/otel-js/export/InstantaneousMetricReader.js.map +1 -1
- package/dist/public/node/vendor/otel-js/service/BaseOtelService/BaseOtelService.d.ts +7 -0
- package/dist/public/node/vendor/otel-js/service/BaseOtelService/BaseOtelService.js +9 -1
- package/dist/public/node/vendor/otel-js/service/BaseOtelService/BaseOtelService.js.map +1 -1
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultOtelService.d.ts +12 -1
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultOtelService.js +11 -0
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultOtelService.js.map +1 -1
- package/dist/public/node/vendor/otel-js/service/types.d.ts +6 -10
- package/dist/public/node/vendor/otel-js/service/types.js.map +1 -1
- package/dist/public/node/vendor/otel-js/utils/throttle.d.ts +10 -2
- package/dist/public/node/vendor/otel-js/utils/throttle.js +9 -0
- package/dist/public/node/vendor/otel-js/utils/throttle.js.map +1 -1
- package/dist/public/node/vendor/otel-js/utils/validators.d.ts +4 -0
- package/dist/public/node/vendor/otel-js/utils/validators.js +4 -0
- package/dist/public/node/vendor/otel-js/utils/validators.js.map +1 -1
- package/dist/public/node/version.js +1 -1
- package/dist/public/node/version.js.map +1 -1
- package/dist/public/node/vscode.js +1 -1
- package/dist/public/node/vscode.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConcurrentOutput, useConcurrentOutputContext } from './ConcurrentOutput.js';
|
|
2
|
-
import { render } from '../../testing/ui.js';
|
|
2
|
+
import { render, waitForContent } from '../../testing/ui.js';
|
|
3
3
|
import { AbortController } from '../../../../public/node/abort.js';
|
|
4
4
|
import { unstyled } from '../../../../public/node/output.js';
|
|
5
5
|
import React from 'react';
|
|
@@ -42,6 +42,8 @@ describe('ConcurrentOutput', () => {
|
|
|
42
42
|
// When
|
|
43
43
|
const renderInstance = render(React.createElement(ConcurrentOutput, { processes: [backendProcess, frontendProcess], abortSignal: new AbortController().signal }));
|
|
44
44
|
await frontendSync.promise;
|
|
45
|
+
// Wait for React 19 to render the process output
|
|
46
|
+
await waitForContent(renderInstance, 'third frontend message');
|
|
45
47
|
// Then
|
|
46
48
|
expect(unstyled(renderInstance.lastFrame().replace(/\d/g, '0'))).toMatchInlineSnapshot(`
|
|
47
49
|
"00:00:00 │ backend │ first backend message
|
|
@@ -69,6 +71,7 @@ describe('ConcurrentOutput', () => {
|
|
|
69
71
|
// When
|
|
70
72
|
const renderInstance = render(React.createElement(ConcurrentOutput, { processes: processes, abortSignal: new AbortController().signal }));
|
|
71
73
|
await processSync.promise;
|
|
74
|
+
await waitForContent(renderInstance, output);
|
|
72
75
|
// Then
|
|
73
76
|
const logColumns = renderInstance.lastFrame().split('│');
|
|
74
77
|
expect(logColumns.length).toBe(3);
|
|
@@ -82,7 +85,6 @@ describe('ConcurrentOutput', () => {
|
|
|
82
85
|
{
|
|
83
86
|
prefix: '1',
|
|
84
87
|
action: async (stdout, _stderr, _signal) => {
|
|
85
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
86
88
|
useConcurrentOutputContext({ stripAnsi: false }, () => {
|
|
87
89
|
stdout.write(output);
|
|
88
90
|
});
|
|
@@ -93,6 +95,7 @@ describe('ConcurrentOutput', () => {
|
|
|
93
95
|
// When
|
|
94
96
|
const renderInstance = render(React.createElement(ConcurrentOutput, { processes: processes, abortSignal: new AbortController().signal }));
|
|
95
97
|
await processSync.promise;
|
|
98
|
+
await waitForContent(renderInstance, 'foo');
|
|
96
99
|
// Then
|
|
97
100
|
const logColumns = renderInstance.lastFrame().split('│');
|
|
98
101
|
expect(logColumns.length).toBe(3);
|
|
@@ -106,7 +109,6 @@ describe('ConcurrentOutput', () => {
|
|
|
106
109
|
{
|
|
107
110
|
prefix: '1',
|
|
108
111
|
action: async (stdout, _stderr, _signal) => {
|
|
109
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
110
112
|
useConcurrentOutputContext({ outputPrefix: extensionName }, () => {
|
|
111
113
|
stdout.write('foo bar');
|
|
112
114
|
});
|
|
@@ -119,6 +121,7 @@ describe('ConcurrentOutput', () => {
|
|
|
119
121
|
// Ensure it's not truncated
|
|
120
122
|
prefixColumnSize: extensionName.length, abortSignal: new AbortController().signal }));
|
|
121
123
|
await processSync.promise;
|
|
124
|
+
await waitForContent(renderInstance, 'foo bar');
|
|
122
125
|
// Then
|
|
123
126
|
const logColumns = unstyled(renderInstance.lastFrame()).split('│');
|
|
124
127
|
expect(logColumns.length).toBe(3);
|
|
@@ -148,6 +151,7 @@ describe('ConcurrentOutput', () => {
|
|
|
148
151
|
// When
|
|
149
152
|
const renderInstance = render(React.createElement(ConcurrentOutput, { processes: processes, prefixColumnSize: columnSize, abortSignal: new AbortController().signal }));
|
|
150
153
|
await Promise.all([processSync1.promise, processSync2.promise]);
|
|
154
|
+
await waitForContent(renderInstance, 'bar');
|
|
151
155
|
// Then
|
|
152
156
|
const logLines = unstyled(renderInstance.lastFrame()).split('\n').filter(Boolean);
|
|
153
157
|
expect(logLines.length).toBe(2);
|
|
@@ -176,6 +180,7 @@ describe('ConcurrentOutput', () => {
|
|
|
176
180
|
// When
|
|
177
181
|
const renderInstance = render(React.createElement(ConcurrentOutput, { processes: processes, abortSignal: new AbortController().signal }));
|
|
178
182
|
await processSync.promise;
|
|
183
|
+
await waitForContent(renderInstance, 'foo');
|
|
179
184
|
// Then
|
|
180
185
|
const logColumns = unstyled(renderInstance.lastFrame()).split('│');
|
|
181
186
|
expect(logColumns.length).toBe(3);
|
|
@@ -198,6 +203,7 @@ describe('ConcurrentOutput', () => {
|
|
|
198
203
|
// When
|
|
199
204
|
const renderInstance = render(React.createElement(ConcurrentOutput, { processes: processes, abortSignal: new AbortController().signal }));
|
|
200
205
|
await processSync.promise;
|
|
206
|
+
await waitForContent(renderInstance, 'foo');
|
|
201
207
|
// Then
|
|
202
208
|
const logColumns = unstyled(renderInstance.lastFrame()).split('│');
|
|
203
209
|
expect(logColumns.length).toBe(3);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConcurrentOutput.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,0BAA0B,EAAC,MAAM,uBAAuB,CAAA;AAClF,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAC,eAAe,EAAc,MAAM,kCAAkC,CAAA;AAC7E,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAG7C;;GAEG;AACH,MAAM,YAAY;IAIhB;QACE,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;YACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACxB,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAED,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,CAAC,2DAA2D,EAAE,KAAK,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rentOutput, useConcurrentOutputContext} from './ConcurrentOutput.js'\nimport {render} from '../../testing/ui.js'\nimport {AbortController, AbortSignal} from '../../../../public/node/abort.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport React from 'react'\nimport {describe, expect, test} from 'vitest'\nimport {Writable} from 'stream'\n\n/**\n * ConcurrentOutput tests are unreliable unless we await a promise that resolves after the process has written to stdout.\n */\nclass Synchronizer {\n resolve: () => void\n promise: Promise<void>\n\n constructor() {\n this.resolve = () => {}\n this.promise = new Promise<void>((resolve, _reject) => {\n this.resolve = resolve\n })\n }\n}\n\ndescribe('ConcurrentOutput', () => {\n test('renders a stream of concurrent outputs from sub-processes', async () => {\n // Given\n const backendSync = new Synchronizer()\n const frontendSync = new Synchronizer()\n\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n\n backendSync.resolve()\n },\n }\n\n const frontendProcess = {\n prefix: 'frontend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n await backendSync.promise\n\n stdout.write('first frontend message')\n stdout.write('second frontend message')\n stdout.write('third frontend message')\n\n frontendSync.resolve()\n },\n }\n // When\n\n const renderInstance = render(\n <ConcurrentOutput processes={[backendProcess, frontendProcess]} abortSignal={new AbortController().signal} />,\n )\n\n await frontendSync.promise\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!.replace(/\\d/g, '0'))).toMatchInlineSnapshot(`\n \"00:00:00 │ backend │ first backend message\n 00:00:00 │ backend │ second backend message\n 00:00:00 │ backend │ third backend message\n 00:00:00 │ frontend │ first frontend message\n 00:00:00 │ frontend │ second frontend message\n 00:00:00 │ frontend │ third frontend message\n \"\n `)\n })\n\n test('strips ansi codes from the output by default', async () => {\n const output = 'foo'\n\n // Given\n const processSync = new Synchronizer()\n const processes = [\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write(`\\u001b[32m${output}\\u001b[39m`)\n processSync.resolve()\n },\n },\n ]\n\n // When\n const renderInstance = render(<ConcurrentOutput processes={processes} abortSignal={new AbortController().signal} />)\n await processSync.promise\n\n // Then\n const logColumns = renderInstance.lastFrame()!.split('│')\n expect(logColumns.length).toBe(3)\n expect(logColumns[2]?.trim()).toEqual(output)\n })\n\n test('does not strip ansi codes from the output when stripAnsi is false', async () => {\n const output = '\\u001b[32mfoo\\u001b[39m'\n\n // Given\n const processSync = new Synchronizer()\n const processes = [\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useConcurrentOutputContext({stripAnsi: false}, () => {\n stdout.write(output)\n })\n processSync.resolve()\n },\n },\n ]\n\n // When\n const renderInstance = render(<ConcurrentOutput processes={processes} abortSignal={new AbortController().signal} />)\n await processSync.promise\n\n // Then\n const logColumns = renderInstance.lastFrame()!.split('│')\n expect(logColumns.length).toBe(3)\n expect(logColumns[2]?.trim()).toEqual(output)\n })\n\n test('renders custom prefixes on log lines', async () => {\n // Given\n const processSync = new Synchronizer()\n const extensionName = 'my-extension'\n const processes = [\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useConcurrentOutputContext({outputPrefix: extensionName}, () => {\n stdout.write('foo bar')\n })\n processSync.resolve()\n },\n },\n ]\n\n // When\n const renderInstance = render(\n <ConcurrentOutput\n processes={processes}\n // Ensure it's not truncated\n prefixColumnSize={extensionName.length}\n abortSignal={new AbortController().signal}\n />,\n )\n\n await processSync.promise\n\n // Then\n const logColumns = unstyled(renderInstance.lastFrame()!).split('│')\n expect(logColumns.length).toBe(3)\n expect(logColumns[1]?.trim()).toEqual(extensionName)\n })\n\n test('renders prefix column width based on prefixColumnSize', async () => {\n // Given\n const processSync1 = new Synchronizer()\n const processSync2 = new Synchronizer()\n\n const columnSize = 5\n const processes = [\n {\n prefix: '1234567890',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('foo')\n processSync1.resolve()\n },\n },\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('bar')\n processSync2.resolve()\n },\n },\n ]\n\n // When\n const renderInstance = render(\n <ConcurrentOutput\n processes={processes}\n prefixColumnSize={columnSize}\n abortSignal={new AbortController().signal}\n />,\n )\n await Promise.all([processSync1.promise, processSync2.promise])\n\n // Then\n const logLines = unstyled(renderInstance.lastFrame()!).split('\\n').filter(Boolean)\n expect(logLines.length).toBe(2)\n logLines.forEach((line) => {\n const logColumns = line.split('│')\n expect(logColumns.length).toBe(3)\n // Including spacing\n expect(logColumns[1]?.length).toBe(columnSize + 2)\n })\n })\n\n test('renders prefix column width based on processes by default', async () => {\n // Given\n const processSync = new Synchronizer()\n const processes = [\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('foo')\n processSync.resolve()\n },\n },\n {prefix: '12', action: async () => {}},\n {prefix: '123', action: async () => {}},\n {prefix: '1234', action: async () => {}},\n ]\n\n // When\n const renderInstance = render(<ConcurrentOutput processes={processes} abortSignal={new AbortController().signal} />)\n await processSync.promise\n\n // Then\n const logColumns = unstyled(renderInstance.lastFrame()!).split('│')\n expect(logColumns.length).toBe(3)\n // 4 is largest prefix, plus spacing\n expect(logColumns[1]?.length).toBe(4 + 2)\n })\n\n test('does not render prefix column larger than max', async () => {\n // Given\n const processSync = new Synchronizer()\n const processes = [\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('foo')\n processSync.resolve()\n },\n },\n {prefix: new Array(26).join('0'), action: async () => {}},\n ]\n\n // When\n const renderInstance = render(<ConcurrentOutput processes={processes} abortSignal={new AbortController().signal} />)\n await processSync.promise\n\n // Then\n const logColumns = unstyled(renderInstance.lastFrame()!).split('│')\n expect(logColumns.length).toBe(3)\n // 25 is largest column allowed, plus spacing\n expect(logColumns[1]?.length).toBe(25 + 2)\n })\n\n test('rejects with the error thrown inside one of the processes', async () => {\n // Given\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n\n throw new Error('something went wrong')\n },\n }\n\n // When\n\n const renderInstance = render(\n <ConcurrentOutput processes={[backendProcess]} abortSignal={new AbortController().signal} />,\n )\n\n const renderPromise = renderInstance.waitUntilExit()\n\n await expect(renderPromise).rejects.toThrowError('something went wrong')\n expect(renderPromise.isRejected()).toBe(true)\n })\n\n test(\"doesn't reject when an error is thrown inside one of the processes and keepRunningAfterProcessesResolve is true\", async () => {\n // Given\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n\n throw new Error('something went wrong')\n },\n }\n\n // When\n\n const renderInstance = render(\n <ConcurrentOutput\n processes={[backendProcess]}\n abortSignal={new AbortController().signal}\n keepRunningAfterProcessesResolve\n />,\n )\n\n await new Promise((resolve) => setTimeout(resolve, 500))\n expect(renderInstance.waitUntilExit().isRejected()).toBe(false)\n })\n\n test('render promise resolves when all processes resolve by default', async () => {\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n },\n }\n\n // When\n const renderInstance = render(\n <ConcurrentOutput processes={[backendProcess]} abortSignal={new AbortController().signal} />,\n )\n\n const renderPromise = renderInstance.waitUntilExit()\n\n await renderPromise\n expect(renderPromise.isFulfilled()).toBe(true)\n })\n\n test(\"render promise doesn't resolve when all processes resolve and keepRunningAfterProcessesResolve is true\", async () => {\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n },\n }\n\n // When\n const renderInstance = render(\n <ConcurrentOutput\n keepRunningAfterProcessesResolve\n processes={[backendProcess]}\n abortSignal={new AbortController().signal}\n />,\n )\n\n await new Promise((resolve) => setTimeout(resolve, 500))\n\n expect(renderInstance.waitUntilExit().isFulfilled()).toBe(false)\n })\n})\n"]}
|
|
1
|
+
{"version":3,"file":"ConcurrentOutput.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,0BAA0B,EAAC,MAAM,uBAAuB,CAAA;AAClF,OAAO,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAC,eAAe,EAAc,MAAM,kCAAkC,CAAA;AAC7E,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAI7C;;GAEG;AACH,MAAM,YAAY;IAIhB;QACE,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;YACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACxB,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAED,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QAC3E,QAAQ;QACR,MAAM,WAAW,GAAG,IAAI,YAAY,EAAE,CAAA;QACtC,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAA;QAEvC,MAAM,cAAc,GAAG;YACrB,MAAM,EAAE,SAAS;YACjB,MAA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,CAAC,CAAC,CAAA;QAExD,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {ConcurrentOutput, useConcurrentOutputContext} from './ConcurrentOutput.js'\nimport {render, waitForContent} from '../../testing/ui.js'\nimport {AbortController, AbortSignal} from '../../../../public/node/abort.js'\nimport {unstyled} from '../../../../public/node/output.js'\n\nimport React from 'react'\nimport {describe, expect, test} from 'vitest'\n\nimport {Writable} from 'stream'\n\n/**\n * ConcurrentOutput tests are unreliable unless we await a promise that resolves after the process has written to stdout.\n */\nclass Synchronizer {\n resolve: () => void\n promise: Promise<void>\n\n constructor() {\n this.resolve = () => {}\n this.promise = new Promise<void>((resolve, _reject) => {\n this.resolve = resolve\n })\n }\n}\n\ndescribe('ConcurrentOutput', () => {\n test('renders a stream of concurrent outputs from sub-processes', async () => {\n // Given\n const backendSync = new Synchronizer()\n const frontendSync = new Synchronizer()\n\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n\n backendSync.resolve()\n },\n }\n\n const frontendProcess = {\n prefix: 'frontend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n await backendSync.promise\n\n stdout.write('first frontend message')\n stdout.write('second frontend message')\n stdout.write('third frontend message')\n\n frontendSync.resolve()\n },\n }\n // When\n\n const renderInstance = render(\n <ConcurrentOutput processes={[backendProcess, frontendProcess]} abortSignal={new AbortController().signal} />,\n )\n\n await frontendSync.promise\n // Wait for React 19 to render the process output\n await waitForContent(renderInstance, 'third frontend message')\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!.replace(/\\d/g, '0'))).toMatchInlineSnapshot(`\n \"00:00:00 │ backend │ first backend message\n 00:00:00 │ backend │ second backend message\n 00:00:00 │ backend │ third backend message\n 00:00:00 │ frontend │ first frontend message\n 00:00:00 │ frontend │ second frontend message\n 00:00:00 │ frontend │ third frontend message\n \"\n `)\n })\n\n test('strips ansi codes from the output by default', async () => {\n const output = 'foo'\n\n // Given\n const processSync = new Synchronizer()\n const processes = [\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write(`\\u001b[32m${output}\\u001b[39m`)\n processSync.resolve()\n },\n },\n ]\n\n // When\n const renderInstance = render(<ConcurrentOutput processes={processes} abortSignal={new AbortController().signal} />)\n await processSync.promise\n await waitForContent(renderInstance, output)\n\n // Then\n const logColumns = renderInstance.lastFrame()!.split('│')\n expect(logColumns.length).toBe(3)\n expect(logColumns[2]?.trim()).toEqual(output)\n })\n\n test('does not strip ansi codes from the output when stripAnsi is false', async () => {\n const output = '\\u001b[32mfoo\\u001b[39m'\n\n // Given\n const processSync = new Synchronizer()\n const processes = [\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n useConcurrentOutputContext({stripAnsi: false}, () => {\n stdout.write(output)\n })\n processSync.resolve()\n },\n },\n ]\n\n // When\n const renderInstance = render(<ConcurrentOutput processes={processes} abortSignal={new AbortController().signal} />)\n await processSync.promise\n await waitForContent(renderInstance, 'foo')\n\n // Then\n const logColumns = renderInstance.lastFrame()!.split('│')\n expect(logColumns.length).toBe(3)\n expect(logColumns[2]?.trim()).toEqual(output)\n })\n\n test('renders custom prefixes on log lines', async () => {\n // Given\n const processSync = new Synchronizer()\n const extensionName = 'my-extension'\n const processes = [\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n useConcurrentOutputContext({outputPrefix: extensionName}, () => {\n stdout.write('foo bar')\n })\n processSync.resolve()\n },\n },\n ]\n\n // When\n const renderInstance = render(\n <ConcurrentOutput\n processes={processes}\n // Ensure it's not truncated\n prefixColumnSize={extensionName.length}\n abortSignal={new AbortController().signal}\n />,\n )\n\n await processSync.promise\n await waitForContent(renderInstance, 'foo bar')\n\n // Then\n const logColumns = unstyled(renderInstance.lastFrame()!).split('│')\n expect(logColumns.length).toBe(3)\n expect(logColumns[1]?.trim()).toEqual(extensionName)\n })\n\n test('renders prefix column width based on prefixColumnSize', async () => {\n // Given\n const processSync1 = new Synchronizer()\n const processSync2 = new Synchronizer()\n\n const columnSize = 5\n const processes = [\n {\n prefix: '1234567890',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('foo')\n processSync1.resolve()\n },\n },\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('bar')\n processSync2.resolve()\n },\n },\n ]\n\n // When\n const renderInstance = render(\n <ConcurrentOutput\n processes={processes}\n prefixColumnSize={columnSize}\n abortSignal={new AbortController().signal}\n />,\n )\n await Promise.all([processSync1.promise, processSync2.promise])\n await waitForContent(renderInstance, 'bar')\n\n // Then\n const logLines = unstyled(renderInstance.lastFrame()!).split('\\n').filter(Boolean)\n expect(logLines.length).toBe(2)\n logLines.forEach((line) => {\n const logColumns = line.split('│')\n expect(logColumns.length).toBe(3)\n // Including spacing\n expect(logColumns[1]?.length).toBe(columnSize + 2)\n })\n })\n\n test('renders prefix column width based on processes by default', async () => {\n // Given\n const processSync = new Synchronizer()\n const processes = [\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('foo')\n processSync.resolve()\n },\n },\n {prefix: '12', action: async () => {}},\n {prefix: '123', action: async () => {}},\n {prefix: '1234', action: async () => {}},\n ]\n\n // When\n const renderInstance = render(<ConcurrentOutput processes={processes} abortSignal={new AbortController().signal} />)\n await processSync.promise\n await waitForContent(renderInstance, 'foo')\n\n // Then\n const logColumns = unstyled(renderInstance.lastFrame()!).split('│')\n expect(logColumns.length).toBe(3)\n // 4 is largest prefix, plus spacing\n expect(logColumns[1]?.length).toBe(4 + 2)\n })\n\n test('does not render prefix column larger than max', async () => {\n // Given\n const processSync = new Synchronizer()\n const processes = [\n {\n prefix: '1',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('foo')\n processSync.resolve()\n },\n },\n {prefix: new Array(26).join('0'), action: async () => {}},\n ]\n\n // When\n const renderInstance = render(<ConcurrentOutput processes={processes} abortSignal={new AbortController().signal} />)\n await processSync.promise\n await waitForContent(renderInstance, 'foo')\n\n // Then\n const logColumns = unstyled(renderInstance.lastFrame()!).split('│')\n expect(logColumns.length).toBe(3)\n // 25 is largest column allowed, plus spacing\n expect(logColumns[1]?.length).toBe(25 + 2)\n })\n\n test('rejects with the error thrown inside one of the processes', async () => {\n // Given\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n\n throw new Error('something went wrong')\n },\n }\n\n // When\n\n const renderInstance = render(\n <ConcurrentOutput processes={[backendProcess]} abortSignal={new AbortController().signal} />,\n )\n\n const renderPromise = renderInstance.waitUntilExit()\n\n await expect(renderPromise).rejects.toThrowError('something went wrong')\n expect(renderPromise.isRejected()).toBe(true)\n })\n\n test(\"doesn't reject when an error is thrown inside one of the processes and keepRunningAfterProcessesResolve is true\", async () => {\n // Given\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n\n throw new Error('something went wrong')\n },\n }\n\n // When\n\n const renderInstance = render(\n <ConcurrentOutput\n processes={[backendProcess]}\n abortSignal={new AbortController().signal}\n keepRunningAfterProcessesResolve\n />,\n )\n\n await new Promise((resolve) => setTimeout(resolve, 500))\n expect(renderInstance.waitUntilExit().isRejected()).toBe(false)\n })\n\n test('render promise resolves when all processes resolve by default', async () => {\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n },\n }\n\n // When\n const renderInstance = render(\n <ConcurrentOutput processes={[backendProcess]} abortSignal={new AbortController().signal} />,\n )\n\n const renderPromise = renderInstance.waitUntilExit()\n\n await renderPromise\n expect(renderPromise.isFulfilled()).toBe(true)\n })\n\n test(\"render promise doesn't resolve when all processes resolve and keepRunningAfterProcessesResolve is true\", async () => {\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n },\n }\n\n // When\n const renderInstance = render(\n <ConcurrentOutput\n keepRunningAfterProcessesResolve\n processes={[backendProcess]}\n abortSignal={new AbortController().signal}\n />,\n )\n\n await new Promise((resolve) => setTimeout(resolve, 500))\n\n expect(renderInstance.waitUntilExit().isFulfilled()).toBe(false)\n })\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DangerousConfirmationPrompt.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/DangerousConfirmationPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAyB,aAAa,EAAC,MAAM,oBAAoB,CAAA;AACxE,OAAO,EAAC,SAAS,EAAiB,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAC,sBAAsB,EAAC,MAAM,iBAAiB,CAAA;AAEtD,OAAO,cAAc,MAAM,8BAA8B,CAAA;AACzD,OAAO,SAAS,EAAE,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"DangerousConfirmationPrompt.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/DangerousConfirmationPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,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C,KAAK,EAAC,KAAK,gBAAiB,CAAC,CAAC,CAAC,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM,gBAAiB,CAAO,CAC1G,CACP,CAAA;AAED,OAAO,EAAC,2BAA2B,EAAC,CAAA","sourcesContent":["import {TextInput} from './TextInput.js'\nimport {InlineToken, TokenItem, TokenizedText} from './TokenizedText.js'\nimport {InfoTable, InfoTableProps} from './Prompts/InfoTable.js'\nimport {handleCtrlC} from '../../ui.js'\nimport useLayout from '../hooks/use-layout.js'\nimport {messageWithPunctuation} from '../utilities.js'\nimport {AbortSignal} from '../../../../public/node/abort.js'\nimport useAbortSignal from '../hooks/use-abort-signal.js'\nimport usePrompt, {PromptState} from '../hooks/use-prompt.js'\n\nimport React, {FunctionComponent, useCallback, useEffect, useState} from 'react'\nimport {Box, useApp, useInput, Text} from 'ink'\nimport figures from 'figures'\n\nexport interface DangerousConfirmationPromptProps {\n message: string\n confirmation: string\n infoTable?: InfoTableProps['table']\n onSubmit: (value: boolean) => void\n abortSignal?: AbortSignal\n}\n\nconst DangerousConfirmationPrompt: FunctionComponent<DangerousConfirmationPromptProps> = ({\n message,\n confirmation,\n infoTable,\n onSubmit,\n abortSignal,\n}) => {\n const validateAnswer = useCallback(\n (value: string): TokenItem<InlineToken> | undefined => {\n return value === confirmation ? undefined : ['Value must be exactly', {userInput: confirmation}]\n },\n [confirmation],\n )\n\n const {oneThird, twoThirds} = useLayout()\n const {promptState, setPromptState, answer, setAnswer} = usePrompt<string>({\n initialAnswer: '',\n })\n const {exit: unmountInk} = useApp()\n const [error, setError] = useState<TokenItem<InlineToken> | undefined>(undefined)\n const color = promptState === PromptState.Error ? 'red' : 'cyan'\n const underline = new Array(oneThird - 3).fill('▔')\n const {isAborted} = useAbortSignal(abortSignal)\n\n useInput((input, key) => {\n handleCtrlC(input, key)\n\n if (key.escape) {\n setPromptState(PromptState.Cancelled)\n setError(undefined)\n }\n\n if (key.return) {\n const error = validateAnswer(answer)\n\n if (error) {\n setPromptState(PromptState.Error)\n setError(error)\n } else {\n setPromptState(PromptState.Submitted)\n }\n }\n })\n\n useEffect(() => {\n if (promptState === PromptState.Submitted) {\n onSubmit(true)\n unmountInk()\n } else if (promptState === PromptState.Cancelled) {\n onSubmit(false)\n unmountInk()\n }\n }, [onSubmit, promptState, unmountInk])\n\n const completed = promptState === PromptState.Submitted || promptState === PromptState.Cancelled\n\n return isAborted ? null : (\n <Box flexDirection=\"column\" marginBottom={1} width={twoThirds}>\n <Box>\n <Box marginRight={2}>\n <Text>?</Text>\n </Box>\n <TokenizedText item={messageWithPunctuation(message)} />\n </Box>\n {completed ? (\n <CompletedPrompt {...{cancelled: promptState === PromptState.Cancelled}} />\n ) : (\n <>\n <Box flexDirection=\"column\" gap={1} marginTop={1} marginLeft={3}>\n {infoTable ? (\n <Box\n paddingLeft={2}\n borderStyle=\"bold\"\n borderLeft\n borderRight={false}\n borderTop={false}\n borderBottom={false}\n flexDirection=\"column\"\n gap={1}\n >\n <InfoTable table={infoTable} />\n </Box>\n ) : null}\n <Box>\n <TokenizedText item={['Type', {userInput: confirmation}, 'to confirm, or press Escape to cancel.']} />\n </Box>\n </Box>\n <Box flexDirection=\"column\" width={oneThird}>\n <Box>\n <Box marginRight={2}>\n <Text color={color}>{`>`}</Text>\n </Box>\n <Box flexGrow={1}>\n <TextInput\n value={answer}\n onChange={(answer) => {\n setAnswer(answer)\n setPromptState(PromptState.Idle)\n }}\n defaultValue=\"\"\n color={color}\n />\n </Box>\n </Box>\n <Box marginLeft={3}>\n <Text color={color}>{underline}</Text>\n </Box>\n {promptState === PromptState.Error && error ? (\n <Box marginLeft={3}>\n <Text color={color}>\n <TokenizedText item={error} />\n </Text>\n </Box>\n ) : null}\n </Box>\n </>\n )}\n </Box>\n )\n}\n\ninterface CompletedPromptProps {\n cancelled: boolean\n}\n\nconst CompletedPrompt: FunctionComponent<CompletedPromptProps> = ({cancelled}) => (\n <Box>\n <Box width={3}>\n {cancelled ? <Text color=\"red\">{figures.cross}</Text> : <Text color=\"cyan\">{figures.tick}</Text>}\n </Box>\n\n <Box flexGrow={1}>{cancelled ? <Text color=\"red\">Cancelled</Text> : <Text color=\"cyan\">Confirmed</Text>}</Box>\n </Box>\n)\n\nexport {DangerousConfirmationPrompt}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DangerousConfirmationPrompt.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/DangerousConfirmationPrompt.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAA;AAC5E,OAAO,EAAC,wBAAwB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,EAAC,MAAM,qBAAqB,CAAA;AACvH,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"DangerousConfirmationPrompt.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/DangerousConfirmationPrompt.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAA;AAC5E,OAAO,EAAC,wBAAwB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,EAAC,MAAM,qBAAqB,CAAA;AACvH,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AAEjD,MAAM,KAAK,GAAG,IAAI,CAAA;AAClB,MAAM,GAAG,GAAG,MAAM,CAAA;AAElB,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE;QACzB,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CACxB,oBAAC,2BAA2B,IAAC,QAAQ,EA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MAAM,cAAc,GAAG,MAAM,CAC3B,oBAAC,2BAA2B,IAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAC,eAAe,EAAC,YAAY,EAAC,KAAK,GAAG,CAC/F,CAAA;QACD,MAAM,sBAAsB,EAAE,CAAA;QAC9B,MAAM,OAAO,GAAG,cAAc,CAAC,aAAa,EAAE,CAAA;QAC9C,MAAM,yBAAyB,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;QAEpD,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,cAAc,CAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;KAIjF,CAAC,CAAA;QACF,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QACjD,MAAM,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {DangerousConfirmationPrompt} from './DangerousConfirmationPrompt.js'\nimport {getLastFrameAfterUnmount, sendInputAndWaitForChange, waitForInputsToBeReady, render} from '../../testing/ui.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport React from 'react'\n\nimport {describe, expect, test, vi} from 'vitest'\n\nconst ENTER = '\\r'\nconst ESC = '\\x1b'\n\ndescribe('DangerousConfirmationPrompt', () => {\n test('default state', () => {\n const {lastFrame} = render(\n <DangerousConfirmationPrompt onSubmit={() => {}} message=\"Test question\" confirmation=\"yes\" />,\n )\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question:\n\n Type yes to confirm, or press Escape to cancel.\n > █\n ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n \"\n `)\n })\n\n test('default validation error', async () => {\n const renderInstance = render(\n <DangerousConfirmationPrompt onSubmit={() => {}} message=\"Test question\" confirmation=\"yes\" />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, ENTER)\n // testing with styles because the color changes to red\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Test question:\n\n Type \u001b[36myes\u001b[39m to confirm, or press Escape to cancel.\n \u001b[31m>\u001b[39m \u001b[31m\u001b[41m█\u001b[49m\u001b[39m\n \u001b[31m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[39m\n \u001b[31mValue must be exactly \u001b[36myes\u001b[39m\n \"\n `)\n await sendInputAndWaitForChange(renderInstance, 'A')\n // color changes back to valid color\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Test question:\n\n Type \u001b[36myes\u001b[39m to confirm, or press Escape to cancel.\n \u001b[36m>\u001b[39m \u001b[36mA\u001b[46m█\u001b[49m\u001b[39m\n \u001b[36m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[39m\n \"\n `)\n })\n\n test('submitting the value', async () => {\n const onSubmit = vi.fn()\n const renderInstance = render(\n <DangerousConfirmationPrompt onSubmit={onSubmit} message=\"Test question\" confirmation=\"yes\" />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, 'yes')\n await sendInputAndWaitForChange(renderInstance, ENTER)\n expect(onSubmit).toHaveBeenCalledWith(true)\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toMatchInlineSnapshot(`\n \"? Test question:\n ✔ Confirmed\n \"\n `)\n })\n\n test('text wrapping', async () => {\n // component width is 80 characters wide in tests but because of the question mark and\n // spaces before the question, we only have 77 characters to work with\n const renderInstance = render(\n <DangerousConfirmationPrompt onSubmit={() => {}} message=\"Test question\" confirmation=\"yes\" />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, 'A'.repeat(77))\n await sendInputAndWaitForChange(renderInstance, 'B'.repeat(6))\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Test question:\n\n Type \u001b[36myes\u001b[39m to confirm, or press Escape to cancel.\n \u001b[36m>\u001b[39m \u001b[36mAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\u001b[39m\n \u001b[36mBBBBBB\u001b[46m█\u001b[49m\u001b[39m\n \u001b[36m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[39m\n \"\n `)\n })\n\n test(\"doesn't append a colon to the message if it ends with a question mark\", async () => {\n const {lastFrame} = render(\n <DangerousConfirmationPrompt onSubmit={() => {}} message=\"Test question?\" confirmation=\"yes\" />,\n )\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n Type yes to confirm, or press Escape to cancel.\n > █\n ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n \"\n `)\n })\n\n test('can use Escape key to exit the prompt gracefully', async () => {\n const onSubmit = vi.fn()\n const renderInstance = render(\n <DangerousConfirmationPrompt onSubmit={onSubmit} message=\"Test question\" confirmation=\"yes\" />,\n )\n await waitForInputsToBeReady()\n const promise = renderInstance.waitUntilExit()\n await sendInputAndWaitForChange(renderInstance, ESC)\n\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toMatchInlineSnapshot(`\n \"? Test question:\n ✘ Cancelled\n \"\n `)\n await expect(promise).resolves.toEqual(undefined)\n expect(onSubmit).toHaveBeenCalledWith(false)\n })\n})\n"]}
|
|
@@ -23,7 +23,6 @@ const FatalError = ({ error }) => {
|
|
|
23
23
|
.map((item) => {
|
|
24
24
|
/** We make the paths relative to the packages/ directory */
|
|
25
25
|
const fileShortComponents = item.fileShort.split('packages/');
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
26
|
item.fileShort = fileShortComponents.length === 2 ? fileShortComponents[1] : fileShortComponents[0];
|
|
28
27
|
return item;
|
|
29
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FatalError.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/FatalError.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAClC,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAC,QAAQ,EAAE,yBAAyB,EAAE,aAAa,EAAsB,MAAM,kCAAkC,CAAA;AACxH,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAA0B,MAAM,OAAO,CAAA;AAC9C,OAAO,WAAW,MAAM,aAAa,CAAA;AAMrC,MAAM,UA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aAAa,IAAC,IAAI,EAAE,OAAO,CAAC,IAAI,GAAI,CACtC,CACG,CACP,CAAC,CACE,CACP,CAAC,CAAC,CAAC,IAAI;QAEP,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CACnC,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ;YACzB,oBAAC,IAAI,8DAA2D;YAC/D,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAChC,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;gBACpD,oBAAC,IAAI;;oBACA,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,IAAE,IAAI,IAAI,CAAC,WAAW,EAAE,CAAQ,CAAC,CAAC,CAAC,IAAI;oBAChF,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CACvD;gBACP,oBAAC,GAAG,IAAC,WAAW,EAAE,CAAC;oBACjB,oBAAC,IAAI,IAAC,QAAQ,UAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAQ,CAC3C,CACF,CACP,CAAC,CACE,CACP,CAAC,CAAC,CAAC,IAAI,CACD,CACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,UAAU,EAAC,CAAA","sourcesContent":["import {Banner} from './Banner.js'\nimport {TokenizedText} from './TokenizedText.js'\nimport {Command} from './Command.js'\nimport {List} from './List.js'\nimport {TabularData} from './TabularData.js'\nimport {BugError, cleanSingleStackTracePath, ExternalError, FatalError as Fatal} from '../../../../public/node/error.js'\nimport {Box, Text} from 'ink'\nimport React, {FunctionComponent} from 'react'\nimport StackTracey from 'stacktracey'\n\ninterface FatalErrorProps {\n error: Fatal\n}\n\nconst FatalError: FunctionComponent<FatalErrorProps> = ({error}) => {\n let stack\n let tool\n\n if (error instanceof BugError) {\n stack = new StackTracey(error)\n stack.items.forEach((item) => {\n item.file = cleanSingleStackTracePath(item.file)\n })\n\n stack = stack.withSources()\n stack = stack\n .filter((entry) => {\n return !entry.file.includes('@oclif/core')\n })\n .map((item) => {\n /** We make the paths relative to the packages/ directory */\n const fileShortComponents = item.fileShort.split('packages/')\n\n item.fileShort = fileShortComponents.length === 2 ? fileShortComponents[1]! : fileShortComponents[0]!\n return item\n })\n }\n\n if (error instanceof ExternalError) {\n tool = `${error.command} ${error.args.join(' ')}`\n }\n\n return (\n <Banner type={tool ? 'external_error' : 'error'}>\n {tool ? (\n <Text>\n Error coming from <Command command={tool} />\n </Text>\n ) : null}\n\n {error.formattedMessage ? <TokenizedText item={error.formattedMessage} /> : <Text>{error.message}</Text>}\n\n {error.tryMessage ? <TokenizedText item={error.tryMessage} /> : null}\n\n {error.nextSteps && error.nextSteps.length > 0 ? <List title=\"Next steps\" items={error.nextSteps} /> : null}\n\n {error.customSections && error.customSections.length > 0 ? (\n <Box flexDirection=\"column\" gap={1}>\n {error.customSections.map((section, index) => (\n <Box key={index} flexDirection=\"column\">\n {section.title ? <Text bold>{section.title}</Text> : null}\n {typeof section.body === 'object' && 'tabularData' in section.body ? (\n <TabularData {...section.body} />\n ) : (\n <TokenizedText item={section.body} />\n )}\n </Box>\n ))}\n </Box>\n ) : null}\n\n {stack && stack.items.length !== 0 ? (\n <Box flexDirection=\"column\">\n <Text>To investigate the issue, examine this stack trace:</Text>\n {stack.items.map((item, index) => (\n <Box flexDirection=\"column\" key={index} paddingLeft={2}>\n <Text>\n at{item.calleeShort ? <Text color=\"yellow\">{` ${item.calleeShort}`}</Text> : null}\n {item.fileShort ? ` (${item.fileShort}:${item.line})` : null}\n </Text>\n <Box paddingLeft={2}>\n <Text dimColor>{item.sourceLine?.trim()}</Text>\n </Box>\n </Box>\n ))}\n </Box>\n ) : null}\n </Banner>\n )\n}\n\nexport {FatalError}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FatalError.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/FatalError.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,kCAAkC,CAAA;AACpF,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,QAAQ,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;IAChC,IAAI,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACxE,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QAChD,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAA;QAExD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;KASpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;QAC5D,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC;YAC3B,mDAAmD;YACnD;gBACE,IAAI,EAAE;oBACJ,KAAK,EAAE;wBACL,uDAAuD;wBACvD,oDAAoD;qBACrD;iBACF;aACF;SACF,CAAC,CAAA;QAEF,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC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AC,CAAC,CAAA;QAExE,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAA;QAExD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;KASpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {FatalError} from './FatalError.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport {AbortError, BugError, ExternalError} from '../../../../public/node/error.js'\nimport {render} from '../../testing/ui.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\n\ndescribe('FatalError', async () => {\n test('renders correctly with a just a message and tryMessage', async () => {\n const error = new AbortError('test', 'try this')\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ test │\n │ │\n │ try this │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with a formatted message', async () => {\n const error = new AbortError([\n 'There has been an error creating your deployment:',\n {\n list: {\n items: [\n 'amortizable-marketplace-ext: Missing expected key(s).',\n \"sub-ui-ext: You don't have access to this feature.\",\n ],\n },\n },\n ])\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ There has been an error creating your deployment: │\n │ • amortizable-marketplace-ext: Missing expected key(s). │\n │ • sub-ui-ext: You don't have access to this feature. │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with a message and a stack', async () => {\n const error = new BugError('Unexpected error')\n error.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n `\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ Unexpected error │\n │ │\n │ To investigate the issue, examine this stack trace: │\n │ at _compile (internal/modules/cjs/loader.js:1137) │\n │ at js (internal/modules/cjs/loader.js:1157) │\n │ at load (internal/modules/cjs/loader.js:985) │\n │ at _load (internal/modules/cjs/loader.js:878) │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with a message, a stack, and next steps', async () => {\n const error = new BugError('Unexpected error')\n error.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n `\n\n error.nextSteps = [\n [\n 'Have you',\n {\n link: {\n label: 'created a Shopify Partners organization',\n url: 'https://partners.shopify.com/signup',\n },\n },\n {\n char: '?',\n },\n ],\n 'Have you confirmed your accounts from the emails you received?',\n [\n 'Need to connect to a different App or organization? Run the command again with',\n {\n command: '--reset',\n },\n ],\n ]\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ Unexpected error │\n │ │\n │ Next steps │\n │ • Have you created a Shopify Partners organization [1]? │\n │ • Have you confirmed your accounts from the emails you received? │\n │ • Need to connect to a different App or organization? Run the command │\n │ again with \\`--reset\\` │\n │ │\n │ To investigate the issue, examine this stack trace: │\n │ at _compile (internal/modules/cjs/loader.js:1137) │\n │ at js (internal/modules/cjs/loader.js:1157) │\n │ at load (internal/modules/cjs/loader.js:985) │\n │ at _load (internal/modules/cjs/loader.js:878) │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n [1] https://partners.shopify.com/signup\n \"\n `)\n })\n\n test('renders correctly with a message, a stack, next steps, and custom sections', async () => {\n const error = new BugError('Unexpected error')\n error.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n `\n\n error.nextSteps = [\n [\n 'Have you',\n {\n link: {\n label: 'created a Shopify Partners organization',\n url: 'https://partners.shopify.com/signup',\n },\n },\n {\n char: '?',\n },\n ],\n 'Have you confirmed your accounts from the emails you received?',\n [\n 'Need to connect to a different App or organization? Run the command again with',\n {\n command: '--reset',\n },\n ],\n ]\n\n error.customSections = [\n {\n title: 'amortizable-marketplace-ext',\n body: [\n {\n list: {\n items: ['Some other error'],\n },\n },\n {\n list: {\n title: 'Validation errors',\n items: ['Missing expected key(s).'],\n },\n },\n ],\n },\n {\n title: 'amortizable-marketplace-ext-2',\n body: [\n {\n list: {\n items: ['Something was not found'],\n },\n },\n ],\n },\n ]\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ Unexpected error │\n │ │\n │ Next steps │\n │ • Have you created a Shopify Partners organization [1]? │\n │ • Have you confirmed your accounts from the emails you received? │\n │ • Need to connect to a different App or organization? Run the command │\n │ again with \\`--reset\\` │\n │ │\n │ amortizable-marketplace-ext │\n │ • Some other error │\n │ Validation errors │\n │ • Missing expected key(s). │\n │ │\n │ amortizable-marketplace-ext-2 │\n │ • Something was not found │\n │ │\n │ To investigate the issue, examine this stack trace: │\n │ at _compile (internal/modules/cjs/loader.js:1137) │\n │ at js (internal/modules/cjs/loader.js:1157) │\n │ at load (internal/modules/cjs/loader.js:985) │\n │ at _load (internal/modules/cjs/loader.js:878) │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n [1] https://partners.shopify.com/signup\n \"\n `)\n })\n\n test('renders correctly an external error', async () => {\n const error = new ExternalError('Unexpected error', 'yarn', ['install'])\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"── external error ──────────────────────────────────────────────────────────────\n\n Error coming from \\`yarn install\\`\n\n Unexpected error\n\n ────────────────────────────────────────────────────────────────────────────────\n \"\n `)\n })\n})\n"]}
|
|
1
|
+
{"version":3,"file":"FatalError.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/FatalError.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,kCAAkC,CAAA;AACpF,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,QAAQ,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;IAChC,IAAI,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACxE,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QAChD,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAA;QAExD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;KASpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,4CAA4C,EA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AExD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACrD,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;QAExE,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAA;QAExD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;KASpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {FatalError} from './FatalError.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport {AbortError, BugError, ExternalError} from '../../../../public/node/error.js'\nimport {render} from '../../testing/ui.js'\nimport {describe, expect, test} from 'vitest'\n\nimport React from 'react'\n\ndescribe('FatalError', async () => {\n test('renders correctly with a just a message and tryMessage', async () => {\n const error = new AbortError('test', 'try this')\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ test │\n │ │\n │ try this │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with a formatted message', async () => {\n const error = new AbortError([\n 'There has been an error creating your deployment:',\n {\n list: {\n items: [\n 'amortizable-marketplace-ext: Missing expected key(s).',\n \"sub-ui-ext: You don't have access to this feature.\",\n ],\n },\n },\n ])\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ There has been an error creating your deployment: │\n │ • amortizable-marketplace-ext: Missing expected key(s). │\n │ • sub-ui-ext: You don't have access to this feature. │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with a message and a stack', async () => {\n const error = new BugError('Unexpected error')\n error.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n `\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ Unexpected error │\n │ │\n │ To investigate the issue, examine this stack trace: │\n │ at _compile (internal/modules/cjs/loader.js:1137) │\n │ at js (internal/modules/cjs/loader.js:1157) │\n │ at load (internal/modules/cjs/loader.js:985) │\n │ at _load (internal/modules/cjs/loader.js:878) │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with a message, a stack, and next steps', async () => {\n const error = new BugError('Unexpected error')\n error.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n `\n\n error.nextSteps = [\n [\n 'Have you',\n {\n link: {\n label: 'created a Shopify Partners organization',\n url: 'https://partners.shopify.com/signup',\n },\n },\n {\n char: '?',\n },\n ],\n 'Have you confirmed your accounts from the emails you received?',\n [\n 'Need to connect to a different App or organization? Run the command again with',\n {\n command: '--reset',\n },\n ],\n ]\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ Unexpected error │\n │ │\n │ Next steps │\n │ • Have you created a Shopify Partners organization [1]? │\n │ • Have you confirmed your accounts from the emails you received? │\n │ • Need to connect to a different App or organization? Run the command │\n │ again with \\`--reset\\` │\n │ │\n │ To investigate the issue, examine this stack trace: │\n │ at _compile (internal/modules/cjs/loader.js:1137) │\n │ at js (internal/modules/cjs/loader.js:1157) │\n │ at load (internal/modules/cjs/loader.js:985) │\n │ at _load (internal/modules/cjs/loader.js:878) │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n [1] https://partners.shopify.com/signup\n \"\n `)\n })\n\n test('renders correctly with a message, a stack, next steps, and custom sections', async () => {\n const error = new BugError('Unexpected error')\n error.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n `\n\n error.nextSteps = [\n [\n 'Have you',\n {\n link: {\n label: 'created a Shopify Partners organization',\n url: 'https://partners.shopify.com/signup',\n },\n },\n {\n char: '?',\n },\n ],\n 'Have you confirmed your accounts from the emails you received?',\n [\n 'Need to connect to a different App or organization? Run the command again with',\n {\n command: '--reset',\n },\n ],\n ]\n\n error.customSections = [\n {\n title: 'amortizable-marketplace-ext',\n body: [\n {\n list: {\n items: ['Some other error'],\n },\n },\n {\n list: {\n title: 'Validation errors',\n items: ['Missing expected key(s).'],\n },\n },\n ],\n },\n {\n title: 'amortizable-marketplace-ext-2',\n body: [\n {\n list: {\n items: ['Something was not found'],\n },\n },\n ],\n },\n ]\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ Unexpected error │\n │ │\n │ Next steps │\n │ • Have you created a Shopify Partners organization [1]? │\n │ • Have you confirmed your accounts from the emails you received? │\n │ • Need to connect to a different App or organization? Run the command │\n │ again with \\`--reset\\` │\n │ │\n │ amortizable-marketplace-ext │\n │ • Some other error │\n │ Validation errors │\n │ • Missing expected key(s). │\n │ │\n │ amortizable-marketplace-ext-2 │\n │ • Something was not found │\n │ │\n │ To investigate the issue, examine this stack trace: │\n │ at _compile (internal/modules/cjs/loader.js:1137) │\n │ at js (internal/modules/cjs/loader.js:1157) │\n │ at load (internal/modules/cjs/loader.js:985) │\n │ at _load (internal/modules/cjs/loader.js:878) │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n [1] https://partners.shopify.com/signup\n \"\n `)\n })\n\n test('renders correctly an external error', async () => {\n const error = new ExternalError('Unexpected error', 'yarn', ['install'])\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"── external error ──────────────────────────────────────────────────────────────\n\n Error coming from \\`yarn install\\`\n\n Unexpected error\n\n ────────────────────────────────────────────────────────────────────────────────\n \"\n `)\n })\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/List.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"List.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/List.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AA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AAI,EAAE;QACtC,MAAM,OAAO,GAAG;YACd,KAAK,EAAE;gBACL,EAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAC;gBAClD,QAAQ;gBACR,EAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAC;aACrD;YACD,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,MAAM;SACd,CAAA;QAED,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,IAAI,OAAK,OAAO,GAAI,CAAC,CAAA;QAEjD,MAAM,CAAC,SAAS,EAAG,CAAC,CAAC,qBAAqB,CAAC;;;;KAI1C,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {List} from './List.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport {render} from '../../testing/ui.js'\nimport {describe, expect, test} from 'vitest'\n\nimport React from 'react'\n\ndescribe('List', async () => {\n test('renders unordered items', async () => {\n const options = {\n title: 'List title',\n items: ['Item 1', 'Item 2', 'Item 3'],\n ordered: false,\n }\n\n const {lastFrame} = render(<List {...options} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"List title\n • Item 1\n • Item 2\n • Item 3\"\n `)\n })\n\n test('renders items with margin or not', async () => {\n const options = {\n items: ['Item 1', 'Item 2', 'Item 3'],\n margin: true,\n }\n\n const {lastFrame: marginLastFrame} = render(<List {...options} />)\n\n expect(unstyled(marginLastFrame()!)).toMatchInlineSnapshot(`\n \" • Item 1\n • Item 2\n • Item 3\"\n `)\n\n const {lastFrame: noMarginLastFrame} = render(<List {...options} margin={false} />)\n\n expect(unstyled(noMarginLastFrame()!)).toMatchInlineSnapshot(`\n \"• Item 1\n • Item 2\n • Item 3\"\n `)\n })\n\n test('can give the text a color', async () => {\n const options = {\n title: 'List title',\n items: ['Item 1', 'Item 2', 'Item 3'],\n color: 'red',\n }\n\n const {lastFrame} = render(<List {...options} />)\n\n expect(lastFrame()).toMatchInlineSnapshot(`\n \"\u001b[31mList title\u001b[39m\n \u001b[31m•\u001b[39m \u001b[31mItem 1\u001b[39m\n \u001b[31m•\u001b[39m \u001b[31mItem 2\u001b[39m\n \u001b[31m•\u001b[39m \u001b[31mItem 3\u001b[39m\"\n `)\n })\n\n test('renders ordered items', async () => {\n const options = {\n items: ['Item 1', 'Item 2', 'Item 3'],\n ordered: true,\n }\n\n const {lastFrame} = render(<List {...options} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \" 1. Item 1\n 2. Item 2\n 3. Item 3\"\n `)\n })\n\n test('title can be made of tokens', async () => {\n const options = {\n title: [\n 'List title',\n {\n bold: ' (bold)',\n },\n ],\n items: ['Item 1', 'Item 2', 'Item 3'],\n ordered: false,\n }\n\n const {lastFrame} = render(<List {...options} />)\n\n expect(lastFrame()).toMatchInlineSnapshot(`\n \"List title \u001b[1m (bold)\u001b[22m\n • Item 1\n • Item 2\n • Item 3\"\n `)\n })\n\n test('renders custom items', async () => {\n const options = {\n items: [\n {bullet: '-', color: 'red', item: 'Custom Item 1'},\n 'Item 1',\n {bullet: '_', color: 'green', item: 'Custom Item 2'},\n ],\n bullet: '*',\n color: 'gray',\n }\n\n const {lastFrame} = render(<List {...options} />)\n\n expect(lastFrame()!).toMatchInlineSnapshot(`\n \" \u001b[31m-\u001b[39m \u001b[31mCustom Item 1\u001b[39m\n \u001b[90m*\u001b[39m \u001b[90mItem 1\u001b[39m\n \u001b[32m_\u001b[39m \u001b[32mCustom Item 2\u001b[39m\"\n `)\n })\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingBar.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/LoadingBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,mCAAmC,CAAA;AACrE,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"LoadingBar.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/LoadingBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,mCAAmC,CAAA;AACrE,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAE7B,MAAM,cAAc,GAAG,GAAG,CAAA;AAC1B,MAAM,UAAU,GAAG,gCAAgC,CAAA;AAQnD,MAAM,UAAU,GAAG,CAAC,EAAC,KAAK,EAAE,OAAO,EAAE,aAAa,EAA2C,EAAE,EAAE;IAC/F,MAAM,EAAC,SAAS,EAAC,GAAG,SAAS,EAAE,CAAA;IAC/B,IAAI,UAAU,GAAG,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACnE,IAAI,OAAO,IAAI,CAAC,mBAAmB,EAAE,EAAE,CAAC;QACtC,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;IAC1E,CAAC;IAED,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ;QACxB,CAAC,aAAa,IAAI,oBAAC,aAAa,IAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,GAAI;QAC3E,oBAAC,IAAI;YAAE,KAAK;mBAAY,CACpB,CACP,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,UAAU,EAAC,CAAA","sourcesContent":["import {TextAnimation} from './TextAnimation.js'\nimport useLayout from '../hooks/use-layout.js'\nimport {shouldDisplayColors} from '../../../../public/node/output.js'\nimport React from 'react'\n\nimport {Box, Text} from 'ink'\n\nconst loadingBarChar = '▀'\nconst hillString = '▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁'\n\ninterface LoadingBarProps {\n title: string\n noColor?: boolean\n noProgressBar?: boolean\n}\n\nconst LoadingBar = ({title, noColor, noProgressBar}: React.PropsWithChildren<LoadingBarProps>) => {\n const {twoThirds} = useLayout()\n let loadingBar = new Array(twoThirds).fill(loadingBarChar).join('')\n if (noColor ?? !shouldDisplayColors()) {\n loadingBar = hillString.repeat(Math.ceil(twoThirds / hillString.length))\n }\n\n return (\n <Box flexDirection=\"column\">\n {!noProgressBar && <TextAnimation text={loadingBar} maxWidth={twoThirds} />}\n <Text>{title} ...</Text>\n </Box>\n )\n}\n\nexport {LoadingBar}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingBar.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/LoadingBar.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAC,mBAAmB,EAAE,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC/E,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AAE7D,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;AACjC,EAAE,CAAC,IAAI,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;IACtD,MAAM,QAAQ,GAAQ,MAAM,EAAE,CAAC,YAAY,CA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AAI,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACtD,QAAQ;QACR,MAAM,KAAK,GAAG,iBAAiB,CAAA;QAC/B,MAAM,KAAK,GAAG,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,CAAA;QAErC,OAAO;QACP,MAAM,EAAC,SAAS,EAAE,MAAM,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,OAAK,KAAK,GAAI,CAAC,CAAA;QAC7D,MAAM,EAAC,SAAS,EAAE,MAAM,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,OAAK,KAAK,GAAI,CAAC,CAAA;QAE7D,OAAO;QACP,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,+CAA+C,EAAE,KAAK,IAAI,EAAE;QAC/D,QAAQ;QACR,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;QACpD,MAAM,KAAK,GAAG,QAAQ,CAAA;QAEtB,OAAO;QACP,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,EAAE,aAAa,SAAG,CAAC,CAAA;QAEtE,OAAO;QACP,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {LoadingBar} from './LoadingBar.js'\nimport {render} from '../../testing/ui.js'\nimport {shouldDisplayColors, unstyled} from '../../../../public/node/output.js'\nimport useLayout from '../hooks/use-layout.js'\nimport React from 'react'\nimport {beforeEach, describe, expect, test, vi} from 'vitest'\n\nvi.mock('../hooks/use-layout.js')\nvi.mock('../../../../public/node/output.js', async () => {\n const original: any = await vi.importActual('../../../../public/node/output.js')\n return {\n ...original,\n shouldDisplayColors: vi.fn(),\n }\n})\n\nbeforeEach(() => {\n // Default terminal width\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 53,\n oneThird: 27,\n fullWidth: 80,\n })\n vi.mocked(shouldDisplayColors).mockReturnValue(true)\n})\n\ndescribe('LoadingBar', () => {\n test('renders loading bar with default colored characters', async () => {\n // Given\n const title = 'Loading content'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n Loading content ...\"\n `)\n })\n\n test('renders loading bar with hill pattern when noColor prop is true', async () => {\n // Given\n const title = 'Processing files'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noColor />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅\n Processing files ...\"\n `)\n })\n\n test('renders loading bar with hill pattern when shouldDisplayColors returns false', async () => {\n // Given\n vi.mocked(shouldDisplayColors).mockReturnValue(false)\n const title = 'Downloading packages'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅\n Downloading packages ...\"\n `)\n })\n\n test('handles narrow terminal width correctly', async () => {\n // Given\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 20,\n oneThird: 10,\n fullWidth: 30,\n })\n const title = 'Building app'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n Building app ...\"\n `)\n })\n\n test('handles narrow terminal width correctly in no-color mode', async () => {\n // Given\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 15,\n oneThird: 8,\n fullWidth: 23,\n })\n const title = 'Installing'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noColor />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇\n Installing ...\"\n `)\n })\n\n test('handles very narrow terminal width in no-color mode', async () => {\n // Given\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 5,\n oneThird: 3,\n fullWidth: 8,\n })\n const title = 'Wait'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noColor />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂\n Wait ...\"\n `)\n })\n\n test('handles wide terminal width correctly', async () => {\n // Given\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 100,\n oneThird: 50,\n fullWidth: 150,\n })\n const title = 'Synchronizing data'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n Synchronizing data ...\"\n `)\n })\n\n test('handles wide terminal width correctly in no-color mode with pattern repetition', async () => {\n // Given\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 90,\n oneThird: 45,\n fullWidth: 135,\n })\n const title = 'Analyzing dependencies'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noColor />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁\n Analyzing dependencies ...\"\n `)\n })\n\n test('renders correctly with empty title', async () => {\n // Given\n const title = ''\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n ...\"\n `)\n })\n\n test('noColor prop overrides shouldDisplayColors when both would show colors', async () => {\n // Given\n vi.mocked(shouldDisplayColors).mockReturnValue(true)\n const title = 'Testing override'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noColor />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅\n Testing override ...\"\n `)\n })\n\n test('renders consistently with same props', async () => {\n // Given\n const title = 'Consistent test'\n const props = {title, noColor: false}\n\n // When\n const {lastFrame: frame1} = render(<LoadingBar {...props} />)\n const {lastFrame: frame2} = render(<LoadingBar {...props} />)\n\n // Then\n expect(frame1()).toBe(frame2())\n })\n\n test('hides progress bar when noProgressBar is true', async () => {\n // Given\n vi.mocked(shouldDisplayColors).mockReturnValue(true)\n const title = 'task 1'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noProgressBar />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\"task 1 ...\"`)\n })\n})\n"]}
|
|
1
|
+
{"version":3,"file":"LoadingBar.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/LoadingBar.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAC,mBAAmB,EAAE,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC/E,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AAE7D,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;AACjC,EAAE,CAAC,IAAI,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;IACtD,MAAM,QAAQ,GAAQ,MAAM,EAAE,CAAC,YAAY,CAAC,mCAAmC,CAAC,CAAA;IAChF,OAAO;QACL,GAAG,QAAQ;QACX,mBAAmB,EAAE,EAAE,CAAC,EAAE,EAAE;KAC7B,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,UAAU,CAAC,GAAG,EAAE;IACd,yBAAyB;IACzB,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC;QACnC,SAAS,EAAE,EAAE;QACb,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;KACd,CAAC,CAAA;IACF,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;AACtD,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,IAAI,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C,CAAC,CAAA;IAEF,IAAI,CAAC,+CAA+C,EAAE,KAAK,IAAI,EAAE;QAC/D,QAAQ;QACR,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;QACpD,MAAM,KAAK,GAAG,QAAQ,CAAA;QAEtB,OAAO;QACP,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,EAAE,aAAa,SAAG,CAAC,CAAA;QAEtE,OAAO;QACP,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {LoadingBar} from './LoadingBar.js'\nimport {render} from '../../testing/ui.js'\nimport {shouldDisplayColors, unstyled} from '../../../../public/node/output.js'\nimport useLayout from '../hooks/use-layout.js'\nimport React from 'react'\n\nimport {beforeEach, describe, expect, test, vi} from 'vitest'\n\nvi.mock('../hooks/use-layout.js')\nvi.mock('../../../../public/node/output.js', async () => {\n const original: any = await vi.importActual('../../../../public/node/output.js')\n return {\n ...original,\n shouldDisplayColors: vi.fn(),\n }\n})\n\nbeforeEach(() => {\n // Default terminal width\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 53,\n oneThird: 27,\n fullWidth: 80,\n })\n vi.mocked(shouldDisplayColors).mockReturnValue(true)\n})\n\ndescribe('LoadingBar', () => {\n test('renders loading bar with default colored characters', async () => {\n // Given\n const title = 'Loading content'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n Loading content ...\"\n `)\n })\n\n test('renders loading bar with hill pattern when noColor prop is true', async () => {\n // Given\n const title = 'Processing files'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noColor />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅\n Processing files ...\"\n `)\n })\n\n test('renders loading bar with hill pattern when shouldDisplayColors returns false', async () => {\n // Given\n vi.mocked(shouldDisplayColors).mockReturnValue(false)\n const title = 'Downloading packages'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅\n Downloading packages ...\"\n `)\n })\n\n test('handles narrow terminal width correctly', async () => {\n // Given\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 20,\n oneThird: 10,\n fullWidth: 30,\n })\n const title = 'Building app'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n Building app ...\"\n `)\n })\n\n test('handles narrow terminal width correctly in no-color mode', async () => {\n // Given\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 15,\n oneThird: 8,\n fullWidth: 23,\n })\n const title = 'Installing'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noColor />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇\n Installing ...\"\n `)\n })\n\n test('handles very narrow terminal width in no-color mode', async () => {\n // Given\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 5,\n oneThird: 3,\n fullWidth: 8,\n })\n const title = 'Wait'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noColor />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂\n Wait ...\"\n `)\n })\n\n test('handles wide terminal width correctly', async () => {\n // Given\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 100,\n oneThird: 50,\n fullWidth: 150,\n })\n const title = 'Synchronizing data'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n Synchronizing data ...\"\n `)\n })\n\n test('handles wide terminal width correctly in no-color mode with pattern repetition', async () => {\n // Given\n vi.mocked(useLayout).mockReturnValue({\n twoThirds: 90,\n oneThird: 45,\n fullWidth: 135,\n })\n const title = 'Analyzing dependencies'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noColor />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁\n Analyzing dependencies ...\"\n `)\n })\n\n test('renders correctly with empty title', async () => {\n // Given\n const title = ''\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n ...\"\n `)\n })\n\n test('noColor prop overrides shouldDisplayColors when both would show colors', async () => {\n // Given\n vi.mocked(shouldDisplayColors).mockReturnValue(true)\n const title = 'Testing override'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noColor />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅▄▄▃▃▂▂▁▁▁▁▂▂▃▃▄▄▅▅▆▆▇▇██▇▇▆▆▅▅\n Testing override ...\"\n `)\n })\n\n test('renders consistently with same props', async () => {\n // Given\n const title = 'Consistent test'\n const props = {title, noColor: false}\n\n // When\n const {lastFrame: frame1} = render(<LoadingBar {...props} />)\n const {lastFrame: frame2} = render(<LoadingBar {...props} />)\n\n // Then\n expect(frame1()).toBe(frame2())\n })\n\n test('hides progress bar when noProgressBar is true', async () => {\n // Given\n vi.mocked(shouldDisplayColors).mockReturnValue(true)\n const title = 'task 1'\n\n // When\n const {lastFrame} = render(<LoadingBar title={title} noProgressBar />)\n\n // Then\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\"task 1 ...\"`)\n })\n})\n"]}
|
|
@@ -12,9 +12,7 @@ export interface InfoTableSection {
|
|
|
12
12
|
emptyItemsText?: string;
|
|
13
13
|
}
|
|
14
14
|
export interface InfoTableProps {
|
|
15
|
-
table:
|
|
16
|
-
[header: string]: Items;
|
|
17
|
-
} | InfoTableSection[];
|
|
15
|
+
table: Record<string, Items> | InfoTableSection[];
|
|
18
16
|
}
|
|
19
17
|
declare const InfoTable: FunctionComponent<InfoTableProps>;
|
|
20
18
|
export { InfoTable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoTable.js","sourceRoot":"","sources":["../../../../../../src/private/node/ui/components/Prompts/InfoTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,IAAI,EAAC,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,wCAAwC,CAAA;AACjE,OAAO,EAAyB,aAAa,EAAC,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAC,GAAG,EAAE,IAAI,EAAY,MAAM,KAAK,CAAA;AACxC,OAAO,KAA0B,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"InfoTable.js","sourceRoot":"","sources":["../../../../../../src/private/node/ui/components/Prompts/InfoTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,IAAI,EAAC,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,wCAAwC,CAAA;AACjE,OAAO,EAAyB,aAAa,EAAC,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAC,GAAG,EAAE,IAAI,EAAY,MAAM,KAAK,CAAA;AACxC,OAAO,KAA0B,MAAM,OAAO,CAAA;AAiB9C,MAAM,SAAS,GAAsC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IAC/D,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACnC,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAClC,MAAM;YAEN,KAAK,EAAE,KAAK,CAAC,MAAM,CAAE;YACrB,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,SAAS;YACrB,MAAM,EAAE,SAAS;YACjB,cAAc,EAAE,SAAS;SAC1B,CAAC,CAAC,CAAA;IAEP,MAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAChC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAC1B,OAAO,IAAI,CAAC,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,OAAO,CAAC,MAAM,GAAI,CAC5F;YACA,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,oBAAC,IAAI,IAAC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAG,OAAO,CAAC,UAAU,CAAQ,CAAC,CAAC,CAAC,IAAI,CAChF,CACF,CACP,CAAC,CACE,CACP,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,SAAS,EAAC,CAAA","sourcesContent":["import {CustomListItem, List} from '../List.js'\nimport {capitalize} from '../../../../../public/common/string.js'\nimport {InlineToken, TokenItem, TokenizedText} from '../TokenizedText.js'\nimport {Box, Text, TextProps} from 'ink'\nimport React, {FunctionComponent} from 'react'\n\ntype Items = (TokenItem<InlineToken> | CustomListItem)[]\n\nexport interface InfoTableSection {\n color?: TextProps['color']\n header: string\n bullet?: string\n helperText?: string\n items: Items\n emptyItemsText?: string\n}\n\nexport interface InfoTableProps {\n table: Record<string, Items> | InfoTableSection[]\n}\n\nconst InfoTable: FunctionComponent<InfoTableProps> = ({table}) => {\n const sections = Array.isArray(table)\n ? table\n : Object.keys(table).map((header) => ({\n header,\n\n items: table[header]!,\n color: undefined,\n helperText: undefined,\n bullet: undefined,\n emptyItemsText: undefined,\n }))\n\n const headerColumnWidth = Math.max(\n ...sections.map((section) => {\n return Math.max(\n ...section.header.split('\\n').map((line) => {\n return line.length\n }),\n )\n }),\n )\n\n return (\n <Box flexDirection=\"column\">\n {sections.map((section, index) => (\n <Box key={index} marginBottom={index === sections.length - 1 ? 0 : 1} flexDirection=\"column\">\n {section.header.length > 0 && (\n <Box width={headerColumnWidth + 1}>\n <Text color={section.color} bold>\n {capitalize(section.header)}\n </Text>\n </Box>\n )}\n <Box flexGrow={1} flexDirection=\"column\" gap={1}>\n {section.emptyItemsText && section.items.length === 0 ? (\n <Text color={section.color}>\n <TokenizedText item={{subdued: section.emptyItemsText}} />\n </Text>\n ) : (\n <List margin={false} items={section.items} color={section.color} bullet={section.bullet} />\n )}\n {section.helperText ? <Text color={section.color}>{section.helperText}</Text> : null}\n </Box>\n </Box>\n ))}\n </Box>\n )\n}\n\nexport {InfoTable}\n"]}
|