@shopify/cli-kit 3.17.0 → 3.19.0

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/assets/success.html +1 -1
  3. package/dist/constants.d.ts +15 -14
  4. package/dist/constants.js +15 -14
  5. package/dist/constants.js.map +1 -1
  6. package/dist/content-tokens.js.map +1 -1
  7. package/dist/environment/service.d.ts +1 -0
  8. package/dist/environment/service.js +3 -0
  9. package/dist/environment/service.js.map +1 -1
  10. package/dist/environment.d.ts +3 -1
  11. package/dist/environment.js +3 -1
  12. package/dist/environment.js.map +1 -1
  13. package/dist/error.js +3 -2
  14. package/dist/error.js.map +1 -1
  15. package/dist/git.js +4 -1
  16. package/dist/git.js.map +1 -1
  17. package/dist/node/cli.js +1 -1
  18. package/dist/node/cli.js.map +1 -1
  19. package/dist/node/colors.d.ts +2 -1
  20. package/dist/node/colors.js +2 -7
  21. package/dist/node/colors.js.map +1 -1
  22. package/dist/node/ruby.js +2 -2
  23. package/dist/node/ruby.js.map +1 -1
  24. package/dist/output.d.ts +10 -16
  25. package/dist/output.js +4 -122
  26. package/dist/output.js.map +1 -1
  27. package/dist/private/node/ui/alert.d.ts +2 -0
  28. package/dist/private/node/ui/alert.js +18 -0
  29. package/dist/private/node/ui/alert.js.map +1 -0
  30. package/dist/private/node/ui/components/Alert.d.ts +17 -0
  31. package/dist/private/node/ui/components/Alert.js +21 -0
  32. package/dist/private/node/ui/components/Alert.js.map +1 -0
  33. package/dist/private/node/ui/components/Banner.d.ts +7 -0
  34. package/dist/private/node/ui/components/Banner.js +35 -0
  35. package/dist/private/node/ui/components/Banner.js.map +1 -0
  36. package/dist/private/node/ui/components/Command.d.ts +9 -0
  37. package/dist/private/node/ui/components/Command.js +10 -0
  38. package/dist/private/node/ui/components/Command.js.map +1 -0
  39. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +48 -0
  40. package/dist/private/node/ui/components/ConcurrentOutput.js +98 -0
  41. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -0
  42. package/dist/private/node/ui/components/Error.d.ts +8 -0
  43. package/dist/private/node/ui/components/Error.js +13 -0
  44. package/dist/private/node/ui/components/Error.js.map +1 -0
  45. package/dist/private/node/ui/components/FatalError.d.ts +7 -0
  46. package/dist/private/node/ui/components/FatalError.js +42 -0
  47. package/dist/private/node/ui/components/FatalError.js.map +1 -0
  48. package/dist/private/node/ui/components/FullScreen.d.ts +8 -0
  49. package/dist/private/node/ui/components/FullScreen.js +32 -0
  50. package/dist/private/node/ui/components/FullScreen.js.map +1 -0
  51. package/dist/private/node/ui/components/Link.d.ts +10 -0
  52. package/dist/private/node/ui/components/Link.js +14 -0
  53. package/dist/private/node/ui/components/Link.js.map +1 -0
  54. package/dist/private/node/ui/components/List.d.ts +13 -0
  55. package/dist/private/node/ui/components/List.js +19 -0
  56. package/dist/private/node/ui/components/List.js.map +1 -0
  57. package/dist/private/node/ui/components/TextAnimation.d.ts +11 -0
  58. package/dist/private/node/ui/components/TextAnimation.js +46 -0
  59. package/dist/private/node/ui/components/TextAnimation.js.map +1 -0
  60. package/dist/private/node/ui/components/TokenizedText.d.ts +21 -0
  61. package/dist/private/node/ui/components/TokenizedText.js +26 -0
  62. package/dist/private/node/ui/components/TokenizedText.js.map +1 -0
  63. package/dist/private/node/ui/error.d.ts +4 -0
  64. package/dist/private/node/ui/error.js +12 -0
  65. package/dist/private/node/ui/error.js.map +1 -0
  66. package/dist/private/node/ui.d.ts +10 -0
  67. package/dist/private/node/ui.js +47 -0
  68. package/dist/private/node/ui.js.map +1 -0
  69. package/dist/public/node/ui.d.ts +155 -0
  70. package/dist/public/node/ui.js +163 -0
  71. package/dist/public/node/ui.js.map +1 -0
  72. package/dist/session.d.ts +10 -0
  73. package/dist/session.js +19 -2
  74. package/dist/session.js.map +1 -1
  75. package/dist/string.d.ts +1 -0
  76. package/dist/string.js +6 -0
  77. package/dist/string.js.map +1 -1
  78. package/dist/system.d.ts +2 -5
  79. package/dist/system.js +19 -19
  80. package/dist/system.js.map +1 -1
  81. package/dist/testing/fixtures/render-concurrent.d.ts +1 -0
  82. package/dist/testing/fixtures/render-concurrent.js +28 -0
  83. package/dist/testing/fixtures/render-concurrent.js.map +1 -0
  84. package/dist/testing/output.d.ts +1 -0
  85. package/dist/testing/output.js +1 -0
  86. package/dist/testing/output.js.map +1 -1
  87. package/dist/testing/ui.d.ts +8 -0
  88. package/dist/testing/ui.js +17 -0
  89. package/dist/testing/ui.js.map +1 -0
  90. package/dist/tsconfig.tsbuildinfo +1 -1
  91. package/dist/ui/inquirer/input.d.ts +1 -1
  92. package/package.json +9 -2
@@ -0,0 +1,13 @@
1
+ import { Banner } from './Banner.js';
2
+ import { TokenizedText } from './TokenizedText.js';
3
+ import { Box, Text } from 'ink';
4
+ import React from 'react';
5
+ const Error = ({ headline, tryMessage }) => {
6
+ return (React.createElement(Banner, { type: "error" },
7
+ React.createElement(Box, null,
8
+ React.createElement(Text, null, headline)),
9
+ tryMessage && (React.createElement(Box, { marginTop: 1 },
10
+ React.createElement(TokenizedText, { item: tryMessage })))));
11
+ };
12
+ export { Error };
13
+ //# sourceMappingURL=Error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Error.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Error.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAClC,OAAO,EAAgB,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,MAAM,KAAK,GAAyB,CAAC,EAAC,QAAQ,EAAE,UAAU,EAAC,EAAE,EAAE;IAC7D,OAAO,CACL,oBAAC,MAAM,IAAC,IAAI,EAAC,OAAO;QAClB,oBAAC,GAAG;YACF,oBAAC,IAAI,QAAE,QAAQ,CAAQ,CACnB;QAEL,UAAU,IAAI,CACb,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;YACf,oBAAC,aAAa,IAAC,IAAI,EAAE,UAAU,GAAI,CAC/B,CACP,CACM,CACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,KAAK,EAAC,CAAA","sourcesContent":["import {Banner} from './Banner.js'\nimport {TextTokenItem, TokenizedText} from './TokenizedText.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\n\nexport interface ErrorProps {\n headline: string\n tryMessage?: TextTokenItem\n}\n\nconst Error: React.FC<ErrorProps> = ({headline, tryMessage}) => {\n return (\n <Banner type=\"error\">\n <Box>\n <Text>{headline}</Text>\n </Box>\n\n {tryMessage && (\n <Box marginTop={1}>\n <TokenizedText item={tryMessage} />\n </Box>\n )}\n </Banner>\n )\n}\n\nexport {Error}\n"]}
@@ -0,0 +1,7 @@
1
+ import { Fatal } from '../../../../error.js';
2
+ import React from 'react';
3
+ export interface FatalErrorProps {
4
+ error: Fatal;
5
+ }
6
+ declare const FatalError: React.FC<FatalErrorProps>;
7
+ export { FatalError };
@@ -0,0 +1,42 @@
1
+ import { Banner } from './Banner.js';
2
+ import { TokenizedText } from './TokenizedText.js';
3
+ import { Bug, cleanSingleStackTracePath } from '../../../../error.js';
4
+ import { Box, Text } from 'ink';
5
+ import React from 'react';
6
+ import StackTracey from 'stacktracey';
7
+ const FatalError = ({ error }) => {
8
+ let stack;
9
+ if (error instanceof Bug) {
10
+ stack = new StackTracey(error);
11
+ stack.items.forEach((item) => {
12
+ item.file = cleanSingleStackTracePath(item.file);
13
+ });
14
+ stack = stack.withSources();
15
+ stack = stack
16
+ .filter((entry) => {
17
+ return !entry.file.includes('@oclif/core');
18
+ })
19
+ .map((item) => {
20
+ /** We make the paths relative to the packages/ directory */
21
+ const fileShortComponents = item.fileShort.split('packages/');
22
+ item.fileShort = fileShortComponents.length === 2 ? fileShortComponents[1] : fileShortComponents[0];
23
+ return item;
24
+ });
25
+ }
26
+ return (React.createElement(Banner, { type: "error" },
27
+ React.createElement(Box, null,
28
+ React.createElement(Text, null, error.message)),
29
+ error.tryMessage && (React.createElement(Box, { marginTop: 1 },
30
+ React.createElement(TokenizedText, { item: error.tryMessage }))),
31
+ stack && stack.items.length !== 0 && (React.createElement(Box, { marginTop: 1, flexDirection: "column" },
32
+ React.createElement(Text, { dimColor: true }, "To investigate the issue, examine this stack trace:"),
33
+ stack.items.map((item, index) => (React.createElement(Box, { flexDirection: "column", key: index },
34
+ React.createElement(Text, null,
35
+ "at",
36
+ item.calleeShort && React.createElement(Text, { color: "yellow" }, ` ${item.calleeShort}`),
37
+ item.fileShort && ` (${item.fileShort}:${item.line})`),
38
+ React.createElement(Box, { paddingLeft: 1 },
39
+ React.createElement(Text, { dimColor: true }, item.sourceLine?.trim())))))))));
40
+ };
41
+ export { FatalError };
42
+ //# sourceMappingURL=FatalError.js.map
@@ -0,0 +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,GAAG,EAAE,yBAAyB,EAAQ,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,WAAW,MAAM,aAAa,CAAA;AAMrC,MAAM,UAAU,GAA8B,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IACxD,IAAI,KAAK,CAAA;IAET,IAAI,KAAK,YAAY,GAAG,EAAE;QACxB,KAAK,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAA;QAC9B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC3B,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClD,CAAC,CAAC,CAAA;QAEF,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;QAC3B,KAAK,GAAG,KAAK;aACV,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YAChB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;QAC5C,CAAC,CAAC;aACD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACZ,4DAA4D;YAC5D,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;YAC7D,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAE,CAAA;YACrG,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;KACL;IAED,OAAO,CACL,oBAAC,MAAM,IAAC,IAAI,EAAC,OAAO;QAClB,oBAAC,GAAG;YACF,oBAAC,IAAI,QAAE,KAAK,CAAC,OAAO,CAAQ,CACxB;QAEL,KAAK,CAAC,UAAU,IAAI,CACnB,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;YACf,oBAAC,aAAa,IAAC,IAAI,EAAE,KAAK,CAAC,UAAU,GAAI,CACrC,CACP;QACA,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CACpC,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ;YACvC,oBAAC,IAAI,IAAC,QAAQ,gEAA2D;YACxE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAChC,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,KAAK;gBACpC,oBAAC,IAAI;;oBACA,IAAI,CAAC,WAAW,IAAI,oBAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,IAAE,IAAI,IAAI,CAAC,WAAW,EAAE,CAAQ;oBAC1E,IAAI,CAAC,SAAS,IAAI,KAAK,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,GAAG,CACjD;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,CACM,CACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,UAAU,EAAC,CAAA","sourcesContent":["import {Banner} from './Banner.js'\nimport {TokenizedText} from './TokenizedText.js'\nimport {Bug, cleanSingleStackTracePath, Fatal} from '../../../../error.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\nimport StackTracey from 'stacktracey'\n\nexport interface FatalErrorProps {\n error: Fatal\n}\n\nconst FatalError: React.FC<FatalErrorProps> = ({error}) => {\n let stack\n\n if (error instanceof Bug) {\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 item.fileShort = fileShortComponents.length === 2 ? fileShortComponents[1]! : fileShortComponents[0]!\n return item\n })\n }\n\n return (\n <Banner type=\"error\">\n <Box>\n <Text>{error.message}</Text>\n </Box>\n\n {error.tryMessage && (\n <Box marginTop={1}>\n <TokenizedText item={error.tryMessage} />\n </Box>\n )}\n {stack && stack.items.length !== 0 && (\n <Box marginTop={1} flexDirection=\"column\">\n <Text dimColor>To investigate the issue, examine this stack trace:</Text>\n {stack.items.map((item, index) => (\n <Box flexDirection=\"column\" key={index}>\n <Text>\n at{item.calleeShort && <Text color=\"yellow\">{` ${item.calleeShort}`}</Text>}\n {item.fileShort && ` (${item.fileShort}:${item.line})`}\n </Text>\n <Box paddingLeft={1}>\n <Text dimColor>{item.sourceLine?.trim()}</Text>\n </Box>\n </Box>\n ))}\n </Box>\n )}\n </Banner>\n )\n}\n\nexport {FatalError}\n"]}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ /**
3
+ * `FullScreen` renders all output in a new buffer and makes it full screen. This is useful when:
4
+ * - You want to preserve terminal history. `ink` [normally clears the terminal history](https://github.com/vadimdemedes/ink/issues/382) if the rendered output is taller than the terminal window. By rendering in a separate buffer history will be preserved and will be visible after pressing `Ctrl+C`.
5
+ * - You want to respond to the resize event of the terminal. Whenever the user resizes their terminal window the output's height and width will be recalculated and re-rendered properly.
6
+ */
7
+ declare const FullScreen: React.FC;
8
+ export default FullScreen;
@@ -0,0 +1,32 @@
1
+ import { Box } from 'ink';
2
+ import React, { useEffect, useState } from 'react';
3
+ /**
4
+ * `FullScreen` renders all output in a new buffer and makes it full screen. This is useful when:
5
+ * - You want to preserve terminal history. `ink` [normally clears the terminal history](https://github.com/vadimdemedes/ink/issues/382) if the rendered output is taller than the terminal window. By rendering in a separate buffer history will be preserved and will be visible after pressing `Ctrl+C`.
6
+ * - You want to respond to the resize event of the terminal. Whenever the user resizes their terminal window the output's height and width will be recalculated and re-rendered properly.
7
+ */
8
+ const FullScreen = (props) => {
9
+ const [size, setSize] = useState({
10
+ columns: process.stdout.columns,
11
+ rows: process.stdout.rows,
12
+ });
13
+ useEffect(() => {
14
+ function onResize() {
15
+ setSize({
16
+ columns: process.stdout.columns,
17
+ rows: process.stdout.rows,
18
+ });
19
+ }
20
+ process.stdout.on('resize', onResize);
21
+ // switch to an alternate buffer
22
+ process.stdout.write('\u001B[?1049h');
23
+ return () => {
24
+ process.stdout.off('resize', onResize);
25
+ // switch back to the main buffer
26
+ process.stdout.write('\u001B[?1049l');
27
+ };
28
+ }, []);
29
+ return (React.createElement(Box, { width: size.columns, height: size.rows }, props.children));
30
+ };
31
+ export default FullScreen;
32
+ //# sourceMappingURL=FullScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FullScreen.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/FullScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAEhD;;;;GAIG;AACH,MAAM,UAAU,GAAa,CAAC,KAAmC,EAAe,EAAE;IAChF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC;QAC/B,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO;QAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;KAC1B,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,QAAQ;YACf,OAAO,CAAC;gBACN,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO;gBAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;aAC1B,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QACrC,gCAAgC;QAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QACrC,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YACtC,iCAAiC;YACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QACvC,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL,oBAAC,GAAG,IAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,IACxC,KAAK,CAAC,QAAQ,CACX,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,UAAU,CAAA","sourcesContent":["import {Box} from 'ink'\nimport React, {useEffect, useState} from 'react'\n\n/**\n * `FullScreen` renders all output in a new buffer and makes it full screen. This is useful when:\n * - You want to preserve terminal history. `ink` [normally clears the terminal history](https://github.com/vadimdemedes/ink/issues/382) if the rendered output is taller than the terminal window. By rendering in a separate buffer history will be preserved and will be visible after pressing `Ctrl+C`.\n * - You want to respond to the resize event of the terminal. Whenever the user resizes their terminal window the output's height and width will be recalculated and re-rendered properly.\n */\nconst FullScreen: React.FC = (props: {children?: React.ReactNode}): JSX.Element => {\n const [size, setSize] = useState({\n columns: process.stdout.columns,\n rows: process.stdout.rows,\n })\n\n useEffect(() => {\n function onResize() {\n setSize({\n columns: process.stdout.columns,\n rows: process.stdout.rows,\n })\n }\n\n process.stdout.on('resize', onResize)\n // switch to an alternate buffer\n process.stdout.write('\\u001B[?1049h')\n return () => {\n process.stdout.off('resize', onResize)\n // switch back to the main buffer\n process.stdout.write('\\u001B[?1049l')\n }\n }, [])\n\n return (\n <Box width={size.columns} height={size.rows}>\n {props.children}\n </Box>\n )\n}\n\nexport default FullScreen\n"]}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ url: string;
4
+ label: string;
5
+ }
6
+ /**
7
+ * `Link` displays a clickable link when supported by the terminal.
8
+ */
9
+ declare const Link: React.FC<Props>;
10
+ export { Link };
@@ -0,0 +1,14 @@
1
+ import { Text, Transform } from 'ink';
2
+ import React from 'react';
3
+ import terminalLink from 'terminal-link';
4
+ /**
5
+ * `Link` displays a clickable link when supported by the terminal.
6
+ */
7
+ const Link = ({ url, label }) => {
8
+ return (React.createElement(Text, null,
9
+ React.createElement(Text, { dimColor: true }, `${label}: `),
10
+ React.createElement(Transform, { transform: (children) => terminalLink(children, url, { fallback: false }) },
11
+ React.createElement(Text, { underline: true }, url))));
12
+ };
13
+ export { Link };
14
+ //# sourceMappingURL=Link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,SAAS,EAAC,MAAM,KAAK,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,YAAY,MAAM,eAAe,CAAA;AAOxC;;GAEG;AACH,MAAM,IAAI,GAAoB,CAAC,EAAC,GAAG,EAAE,KAAK,EAAiC,EAAe,EAAE;IAC1F,OAAO,CACL,oBAAC,IAAI;QACH,oBAAC,IAAI,IAAC,QAAQ,UAAE,GAAG,KAAK,IAAI,CAAQ;QACpC,oBAAC,SAAS,IAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;YAChF,oBAAC,IAAI,IAAC,SAAS,UAAE,GAAG,CAAQ,CAClB,CACP,CACR,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,IAAI,EAAC,CAAA","sourcesContent":["import {Text, Transform} from 'ink'\nimport React from 'react'\nimport terminalLink from 'terminal-link'\n\ninterface Props {\n url: string\n label: string\n}\n\n/**\n * `Link` displays a clickable link when supported by the terminal.\n */\nconst Link: React.FC<Props> = ({url, label}: React.PropsWithChildren<Props>): JSX.Element => {\n return (\n <Text>\n <Text dimColor>{`${label}: `}</Text>\n <Transform transform={(children) => terminalLink(children, url, {fallback: false})}>\n <Text underline>{url}</Text>\n </Transform>\n </Text>\n )\n}\n\nexport {Link}\n"]}
@@ -0,0 +1,13 @@
1
+ import { TextTokenItem } from './TokenizedText.js';
2
+ import React from 'react';
3
+ interface Props {
4
+ title: string;
5
+ items: TextTokenItem[];
6
+ ordered?: boolean;
7
+ }
8
+ /**
9
+ * `List` displays an unordered or ordered list with text aligned with the bullet point
10
+ * and wrapped to the container width.
11
+ */
12
+ declare const List: React.FC<Props>;
13
+ export { List };
@@ -0,0 +1,19 @@
1
+ import { TokenizedText } from './TokenizedText.js';
2
+ import { Box, Text } from 'ink';
3
+ import React from 'react';
4
+ const DOT = '•';
5
+ /**
6
+ * `List` displays an unordered or ordered list with text aligned with the bullet point
7
+ * and wrapped to the container width.
8
+ */
9
+ const List = ({ title, items, ordered = false }) => {
10
+ return (React.createElement(Box, { flexDirection: "column" },
11
+ React.createElement(Text, { dimColor: true }, title),
12
+ items.map((item, index) => (React.createElement(Box, { key: index },
13
+ React.createElement(Box, null,
14
+ React.createElement(Text, { dimColor: true }, ` ${ordered ? `${index + 1}.` : DOT}`)),
15
+ React.createElement(Box, { flexGrow: 1, marginLeft: 1 },
16
+ React.createElement(TokenizedText, { item: item })))))));
17
+ };
18
+ export { List };
19
+ //# sourceMappingURL=List.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/List.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,MAAM,GAAG,GAAG,GAAG,CAAA;AAEf;;;GAGG;AACH,MAAM,IAAI,GAAoB,CAAC,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,EAAiC,EAAe,EAAE;IAC7G,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ;QACzB,oBAAC,IAAI,IAAC,QAAQ,UAAE,KAAK,CAAQ;QAC5B,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,oBAAC,GAAG,IAAC,GAAG,EAAE,KAAK;YACb,oBAAC,GAAG;gBACF,oBAAC,IAAI,IAAC,QAAQ,UAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAQ,CAC1D;YAEN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC;gBAC7B,oBAAC,aAAa,IAAC,IAAI,EAAE,IAAI,GAAI,CACzB,CACF,CACP,CAAC,CACE,CACP,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,IAAI,EAAC,CAAA","sourcesContent":["import {TextTokenItem, TokenizedText} from './TokenizedText.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\n\ninterface Props {\n title: string\n items: TextTokenItem[]\n ordered?: boolean\n}\n\nconst DOT = '•'\n\n/**\n * `List` displays an unordered or ordered list with text aligned with the bullet point\n * and wrapped to the container width.\n */\nconst List: React.FC<Props> = ({title, items, ordered = false}: React.PropsWithChildren<Props>): JSX.Element => {\n return (\n <Box flexDirection=\"column\">\n <Text dimColor>{title}</Text>\n {items.map((item, index) => (\n <Box key={index}>\n <Box>\n <Text dimColor>{` ${ordered ? `${index + 1}.` : DOT}`}</Text>\n </Box>\n\n <Box flexGrow={1} marginLeft={1}>\n <TokenizedText item={item} />\n </Box>\n </Box>\n ))}\n </Box>\n )\n}\n\nexport {List}\n"]}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ declare type AnimationName = 'rainbow' | 'pulse' | 'glitch' | 'radar' | 'neon' | 'karaoke';
3
+ interface Props {
4
+ name?: AnimationName;
5
+ speed?: number;
6
+ }
7
+ /**
8
+ * `TextAnimation` applies animations from [chalk-animation](https://github.com/bokub/chalk-animation) to `Text` Children
9
+ */
10
+ declare const TextAnimation: React.FC<Props>;
11
+ export { TextAnimation };
@@ -0,0 +1,46 @@
1
+ import { renderString } from '../../ui.js';
2
+ import chalkAnimation from 'chalk-animation';
3
+ import { Text } from 'ink';
4
+ import React, { useEffect, useState } from 'react';
5
+ const delays = {
6
+ rainbow: 15,
7
+ pulse: 16,
8
+ glitch: 55,
9
+ radar: 50,
10
+ neon: 500,
11
+ karaoke: 50,
12
+ };
13
+ /**
14
+ * `TextAnimation` applies animations from [chalk-animation](https://github.com/bokub/chalk-animation) to `Text` Children
15
+ */
16
+ const TextAnimation = ({ name = 'rainbow', speed = 1, children, }) => {
17
+ const [animationTimeout, setAnimationTimeout] = useState(null);
18
+ const animation = chalkAnimation[name]('').stop();
19
+ const [frame, setFrame] = useState('');
20
+ const start = () => {
21
+ const { output } = renderString(React.createElement(Text, null, children));
22
+ // There's probably some clashing between `chalk-animation` and Ink's rendering mechanism
23
+ // (which uses `log-update`). The solution is to remove the ANSI escape sequence at the
24
+ // start of the frame that we're getting from `chalk-animation` that tells the terminal to
25
+ // clear the lines.
26
+ const frame = animation
27
+ .replace(output ?? '')
28
+ .frame()
29
+ .replace(/^\u001B\[(\d)F\u001B\[G\u001B\[2K/, ''); // eslint-disable-line no-control-regex
30
+ setFrame(frame);
31
+ setAnimationTimeout(setTimeout(() => {
32
+ start();
33
+ }, delays[name] / speed));
34
+ };
35
+ useEffect(() => {
36
+ start();
37
+ return () => {
38
+ if (animationTimeout)
39
+ clearTimeout(animationTimeout);
40
+ setAnimationTimeout(null);
41
+ };
42
+ }, []);
43
+ return React.createElement(Text, null, frame);
44
+ };
45
+ export { TextAnimation };
46
+ //# sourceMappingURL=TextAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextAnimation.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TextAnimation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAA;AACxC,OAAO,cAAc,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAShD,MAAM,MAAM,GAAqC;IAC/C,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,EAAE;CACZ,CAAA;AAED;;GAEG;AACH,MAAM,aAAa,GAAoB,CAAC,EACtC,IAAI,GAAG,SAAS,EAChB,KAAK,GAAG,CAAC,EACT,QAAQ,GACuB,EAAe,EAAE;IAChD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC,CAAA;IACrF,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEtC,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,MAAM,EAAC,MAAM,EAAC,GAAG,YAAY,CAAC,oBAAC,IAAI,QAAE,QAAQ,CAAQ,CAAC,CAAA;QAEtD,yFAAyF;QACzF,uFAAuF;QACvF,0FAA0F;QAC1F,mBAAmB;QAEnB,MAAM,KAAK,GAAG,SAAS;aACpB,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;aACrB,KAAK,EAAE;aACP,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAA,CAAC,uCAAuC;QAE3F,QAAQ,CAAC,KAAK,CAAC,CAAA;QAEf,mBAAmB,CACjB,UAAU,CAAC,GAAG,EAAE;YACd,KAAK,EAAE,CAAA;QACT,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CACzB,CAAA;IACH,CAAC,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,EAAE,CAAA;QAEP,OAAO,GAAG,EAAE;YACV,IAAI,gBAAgB;gBAAE,YAAY,CAAC,gBAAgB,CAAC,CAAA;YAEpD,mBAAmB,CAAC,IAAI,CAAC,CAAA;QAC3B,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,oBAAC,IAAI,QAAE,KAAK,CAAQ,CAAA;AAC7B,CAAC,CAAA;AAED,OAAO,EAAC,aAAa,EAAC,CAAA","sourcesContent":["import {renderString} from '../../ui.js'\nimport chalkAnimation from 'chalk-animation'\nimport {Text} from 'ink'\nimport React, {useEffect, useState} from 'react'\n\ntype AnimationName = 'rainbow' | 'pulse' | 'glitch' | 'radar' | 'neon' | 'karaoke'\n\ninterface Props {\n name?: AnimationName\n speed?: number\n}\n\nconst delays: {[key in AnimationName]: number} = {\n rainbow: 15,\n pulse: 16,\n glitch: 55,\n radar: 50,\n neon: 500,\n karaoke: 50,\n}\n\n/**\n * `TextAnimation` applies animations from [chalk-animation](https://github.com/bokub/chalk-animation) to `Text` Children\n */\nconst TextAnimation: React.FC<Props> = ({\n name = 'rainbow',\n speed = 1,\n children,\n}: React.PropsWithChildren<Props>): JSX.Element => {\n const [animationTimeout, setAnimationTimeout] = useState<NodeJS.Timeout | null>(null)\n const animation = chalkAnimation[name]('').stop()\n const [frame, setFrame] = useState('')\n\n const start = () => {\n const {output} = renderString(<Text>{children}</Text>)\n\n // There's probably some clashing between `chalk-animation` and Ink's rendering mechanism\n // (which uses `log-update`). The solution is to remove the ANSI escape sequence at the\n // start of the frame that we're getting from `chalk-animation` that tells the terminal to\n // clear the lines.\n\n const frame = animation\n .replace(output ?? '')\n .frame()\n .replace(/^\\u001B\\[(\\d)F\\u001B\\[G\\u001B\\[2K/, '') // eslint-disable-line no-control-regex\n\n setFrame(frame)\n\n setAnimationTimeout(\n setTimeout(() => {\n start()\n }, delays[name] / speed),\n )\n }\n\n useEffect(() => {\n start()\n\n return () => {\n if (animationTimeout) clearTimeout(animationTimeout)\n\n setAnimationTimeout(null)\n }\n }, [])\n\n return <Text>{frame}</Text>\n}\n\nexport {TextAnimation}\n"]}
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ interface CommandToken {
3
+ command: string;
4
+ }
5
+ interface LinkToken {
6
+ link: {
7
+ label: string;
8
+ url: string;
9
+ };
10
+ }
11
+ export declare type TextToken = string | CommandToken | LinkToken;
12
+ export declare type TextTokenItem = TextToken | TextToken[];
13
+ interface Props {
14
+ item: TextToken | TextToken[];
15
+ }
16
+ /**
17
+ * `TokenizedText` renders a text string with tokens that can be either strings,
18
+ * links, and commands.
19
+ */
20
+ declare const TokenizedText: React.FC<Props>;
21
+ export { TokenizedText };
@@ -0,0 +1,26 @@
1
+ import { Command } from './Command.js';
2
+ import { Link } from './Link.js';
3
+ import { Text } from 'ink';
4
+ import React from 'react';
5
+ /**
6
+ * `TokenizedText` renders a text string with tokens that can be either strings,
7
+ * links, and commands.
8
+ */
9
+ const TokenizedText = ({ item }) => {
10
+ if (typeof item === 'string') {
11
+ return React.createElement(Text, { dimColor: true }, item);
12
+ }
13
+ else if ('command' in item) {
14
+ return React.createElement(Command, { command: item.command });
15
+ }
16
+ else if ('link' in item) {
17
+ return React.createElement(Link, { ...item.link });
18
+ }
19
+ else {
20
+ return (React.createElement(Text, null, item.map((listItem, index) => (React.createElement(Text, { key: index },
21
+ React.createElement(TokenizedText, { item: listItem }),
22
+ index < item.length - 1 && React.createElement(Text, null, " "))))));
23
+ }
24
+ };
25
+ export { TokenizedText };
26
+ //# sourceMappingURL=TokenizedText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenizedText.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TokenizedText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,MAAM,OAAO,CAAA;AAoBzB;;;GAGG;AACH,MAAM,aAAa,GAAoB,CAAC,EAAC,IAAI,EAAC,EAAE,EAAE;IAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,oBAAC,IAAI,IAAC,QAAQ,UAAE,IAAI,CAAQ,CAAA;KACpC;SAAM,IAAI,SAAS,IAAI,IAAI,EAAE;QAC5B,OAAO,oBAAC,OAAO,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI,CAAA;KAC1C;SAAM,IAAI,MAAM,IAAI,IAAI,EAAE;QACzB,OAAO,oBAAC,IAAI,OAAK,IAAI,CAAC,IAAI,GAAI,CAAA;KAC/B;SAAM;QACL,OAAO,CACL,oBAAC,IAAI,QACF,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,CAC7B,oBAAC,IAAI,IAAC,GAAG,EAAE,KAAK;YACd,oBAAC,aAAa,IAAC,IAAI,EAAE,QAAQ,GAAI;YAChC,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,oBAAC,IAAI,YAAS,CACrC,CACR,CAAC,CACG,CACR,CAAA;KACF;AACH,CAAC,CAAA;AAED,OAAO,EAAC,aAAa,EAAC,CAAA","sourcesContent":["import {Command} from './Command.js'\nimport {Link} from './Link.js'\nimport {Text} from 'ink'\nimport React from 'react'\n\ninterface CommandToken {\n command: string\n}\n\ninterface LinkToken {\n link: {\n label: string\n url: string\n }\n}\n\nexport type TextToken = string | CommandToken | LinkToken\nexport type TextTokenItem = TextToken | TextToken[]\n\ninterface Props {\n item: TextToken | TextToken[]\n}\n\n/**\n * `TokenizedText` renders a text string with tokens that can be either strings,\n * links, and commands.\n */\nconst TokenizedText: React.FC<Props> = ({item}) => {\n if (typeof item === 'string') {\n return <Text dimColor>{item}</Text>\n } else if ('command' in item) {\n return <Command command={item.command} />\n } else if ('link' in item) {\n return <Link {...item.link} />\n } else {\n return (\n <Text>\n {item.map((listItem, index) => (\n <Text key={index}>\n <TokenizedText item={listItem} />\n {index < item.length - 1 && <Text> </Text>}\n </Text>\n ))}\n </Text>\n )\n }\n}\n\nexport {TokenizedText}\n"]}
@@ -0,0 +1,4 @@
1
+ import { ErrorProps } from './components/Error.js';
2
+ import { Fatal } from '../../../error.js';
3
+ export declare function fatalError(error: Fatal): void;
4
+ export declare function error({ headline, tryMessage }: ErrorProps): void;
@@ -0,0 +1,12 @@
1
+ import { Error } from './components/Error.js';
2
+ import { FatalError } from './components/FatalError.js';
3
+ import { renderOnce } from '../ui.js';
4
+ import { consoleError } from '../../../output.js';
5
+ import React from 'react';
6
+ export function fatalError(error) {
7
+ renderOnce(React.createElement(FatalError, { error: error }), 'error', consoleError);
8
+ }
9
+ export function error({ headline, tryMessage }) {
10
+ renderOnce(React.createElement(Error, { headline: headline, tryMessage: tryMessage }), 'error', consoleError);
11
+ }
12
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../src/private/node/ui/error.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,EAAC,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAA;AAErD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAA;AACnC,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,UAAU,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;AACjE,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,EAAC,QAAQ,EAAE,UAAU,EAAa;IACtD,UAAU,CAAC,oBAAC,KAAK,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,GAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;AAC1F,CAAC","sourcesContent":["import {ErrorProps, Error} from './components/Error.js'\nimport {FatalError} from './components/FatalError.js'\nimport {Fatal} from '../../../error.js'\nimport {renderOnce} from '../ui.js'\nimport {consoleError} from '../../../output.js'\nimport React from 'react'\n\nexport function fatalError(error: Fatal) {\n renderOnce(<FatalError error={error} />, 'error', consoleError)\n}\n\nexport function error({headline, tryMessage}: ErrorProps) {\n renderOnce(<Error headline={headline} tryMessage={tryMessage} />, 'error', consoleError)\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { Logger, LogLevel } from '../../output.js';
2
+ import { ReactElement } from 'react';
3
+ export declare function renderOnce(element: JSX.Element, logLevel?: LogLevel, logger?: Logger): void;
4
+ export declare function render(element: JSX.Element): import("ink").Instance;
5
+ interface Instance {
6
+ output: string | undefined;
7
+ unmount: () => void;
8
+ }
9
+ export declare const renderString: (element: ReactElement) => Instance;
10
+ export {};
@@ -0,0 +1,47 @@
1
+ import { isUnitTest } from '../../environment/local.js';
2
+ import { collectLog, consoleLog, outputWhereAppropriate } from '../../output.js';
3
+ import { render as inkRender } from 'ink';
4
+ import { EventEmitter } from 'events';
5
+ export function renderOnce(element, logLevel = 'info', logger = consoleLog) {
6
+ const { output, unmount } = renderString(element);
7
+ if (output) {
8
+ if (isUnitTest())
9
+ collectLog(logLevel, output);
10
+ outputWhereAppropriate(logLevel, logger, output);
11
+ }
12
+ unmount();
13
+ }
14
+ export function render(element) {
15
+ return inkRender(element);
16
+ }
17
+ const TEST_TERMINAL_WIDTH = 80;
18
+ class OutputStream extends EventEmitter {
19
+ constructor(options) {
20
+ super();
21
+ this.write = (frame) => {
22
+ this._lastFrame = frame;
23
+ };
24
+ this.lastFrame = () => {
25
+ return this._lastFrame;
26
+ };
27
+ this.columns = options.columns;
28
+ }
29
+ }
30
+ export const renderString = (element) => {
31
+ const stdout = new OutputStream({ columns: isUnitTest() ? TEST_TERMINAL_WIDTH : process.stdout.columns });
32
+ const stderr = new OutputStream({ columns: isUnitTest() ? TEST_TERMINAL_WIDTH : process.stderr.columns });
33
+ const instance = inkRender(element, {
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
+ stdout: stdout,
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
+ stderr: stderr,
38
+ debug: true,
39
+ exitOnCtrlC: false,
40
+ patchConsole: false,
41
+ });
42
+ return {
43
+ output: stdout.lastFrame(),
44
+ unmount: instance.unmount,
45
+ };
46
+ };
47
+ //# sourceMappingURL=ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/private/node/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAC,UAAU,EAAE,UAAU,EAAoB,sBAAsB,EAAC,MAAM,iBAAiB,CAAA;AAEhG,OAAO,EAAC,MAAM,IAAI,SAAS,EAAC,MAAM,KAAK,CAAA;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAA;AAEnC,MAAM,UAAU,UAAU,CAAC,OAAoB,EAAE,WAAqB,MAAM,EAAE,SAAiB,UAAU;IACvG,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IAE/C,IAAI,MAAM,EAAE;QACV,IAAI,UAAU,EAAE;YAAE,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC9C,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KACjD;IAED,OAAO,EAAE,CAAA;AACX,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAoB;IACzC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAA;AAC3B,CAAC;AAOD,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAC9B,MAAM,YAAa,SAAQ,YAAY;IAIrC,YAAY,OAA0B;QACpC,KAAK,EAAE,CAAA;QAIT,UAAK,GAAG,CAAC,KAAa,EAAE,EAAE;YACxB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;QACzB,CAAC,CAAA;QAED,cAAS,GAAG,GAAG,EAAE;YACf,OAAO,IAAI,CAAC,UAAU,CAAA;QACxB,CAAC,CAAA;QATC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;IAChC,CAAC;CASF;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAqB,EAAY,EAAE;IAC9D,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAC,CAAC,CAAA;IACvG,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAC,CAAC,CAAA;IAEvG,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,EAAE;QAClC,8DAA8D;QAC9D,MAAM,EAAE,MAAa;QACrB,8DAA8D;QAC9D,MAAM,EAAE,MAAa;QACrB,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAA;IAEF,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE;QAC1B,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAA;AACH,CAAC,CAAA","sourcesContent":["import {isUnitTest} from '../../environment/local.js'\nimport {collectLog, consoleLog, Logger, LogLevel, outputWhereAppropriate} from '../../output.js'\nimport {ReactElement} from 'react'\nimport {render as inkRender} from 'ink'\nimport {EventEmitter} from 'events'\n\nexport function renderOnce(element: JSX.Element, logLevel: LogLevel = 'info', logger: Logger = consoleLog) {\n const {output, unmount} = renderString(element)\n\n if (output) {\n if (isUnitTest()) collectLog(logLevel, output)\n outputWhereAppropriate(logLevel, logger, output)\n }\n\n unmount()\n}\n\nexport function render(element: JSX.Element) {\n return inkRender(element)\n}\n\ninterface Instance {\n output: string | undefined\n unmount: () => void\n}\n\nconst TEST_TERMINAL_WIDTH = 80\nclass OutputStream extends EventEmitter {\n columns: number\n private _lastFrame?: string\n\n constructor(options: {columns: number}) {\n super()\n this.columns = options.columns\n }\n\n write = (frame: string) => {\n this._lastFrame = frame\n }\n\n lastFrame = () => {\n return this._lastFrame\n }\n}\n\nexport const renderString = (element: ReactElement): Instance => {\n const stdout = new OutputStream({columns: isUnitTest() ? TEST_TERMINAL_WIDTH : process.stdout.columns})\n const stderr = new OutputStream({columns: isUnitTest() ? TEST_TERMINAL_WIDTH : process.stderr.columns})\n\n const instance = inkRender(element, {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stdout: stdout as any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stderr: stderr as any,\n debug: true,\n exitOnCtrlC: false,\n patchConsole: false,\n })\n\n return {\n output: stdout.lastFrame(),\n unmount: instance.unmount,\n }\n}\n"]}
@@ -0,0 +1,155 @@
1
+ import { OutputProcess } from '../../output.js';
2
+ import { Fatal } from '../../error.js';
3
+ import { AlertProps } from '../../private/node/ui/components/Alert.js';
4
+ import { ErrorProps } from '../../private/node/ui/components/Error.js';
5
+ import { AbortController } from 'abort-controller';
6
+ interface RenderConcurrentOptions {
7
+ processes: OutputProcess[];
8
+ abortController?: AbortController;
9
+ showTimestamps?: boolean;
10
+ }
11
+ /**
12
+ * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.
13
+ */
14
+ export declare function renderConcurrent({ processes, abortController, showTimestamps }: RenderConcurrentOptions): Promise<void>;
15
+ declare type RenderAlertOptions = Omit<AlertProps, 'type'>;
16
+ /**
17
+ * Renders an information banner to the console.
18
+ *
19
+ * Basic:
20
+ *
21
+ * ```
22
+ * ╭─ info ───────────────────────────────────────────────────╮
23
+ * │ │
24
+ * │ Body │
25
+ * │ │
26
+ * ╰──────────────────────────────────────────────────────────╯
27
+ * ```
28
+ *
29
+ * Complete:
30
+ * ```
31
+ * ╭─ info ───────────────────────────────────────────────────╮
32
+ * │ │
33
+ * │ Title │
34
+ * │ │
35
+ * │ Body │
36
+ * │ │
37
+ * │ Next steps │
38
+ * │ • Run cd santorini-goods │
39
+ * │ • To preview your project, run npm app dev │
40
+ * │ • To add extensions, run npm generate extension │
41
+ * │ │
42
+ * │ Reference │
43
+ * │ • Run npm shopify help │
44
+ * │ • Press 'return' to open the dev docs: │
45
+ * │ https://shopify.dev │
46
+ * │ │
47
+ * │ Link: https://shopify.com │
48
+ * │ │
49
+ * ╰──────────────────────────────────────────────────────────╯
50
+ * ```
51
+ */
52
+ export declare function renderInfo(options: RenderAlertOptions): void;
53
+ /**
54
+ * Renders a success banner to the console.
55
+ *
56
+ * Basic:
57
+ *
58
+ * ```
59
+ * ╭─ success ────────────────────────────────────────────────╮
60
+ * │ │
61
+ * │ Title │
62
+ * │ │
63
+ * ╰──────────────────────────────────────────────────────────╯
64
+ * ```
65
+ *
66
+ * Complete:
67
+ * ```
68
+ * ╭─ success ────────────────────────────────────────────────╮
69
+ * │ │
70
+ * │ Title │
71
+ * │ │
72
+ * │ Body │
73
+ * │ │
74
+ * │ Next steps │
75
+ * │ • Run cd santorini-goods │
76
+ * │ • To preview your project, run npm app dev │
77
+ * │ • To add extensions, run npm generate extension │
78
+ * │ │
79
+ * │ Reference │
80
+ * │ • Run npm shopify help │
81
+ * │ • Press 'return' to open the dev docs: │
82
+ * │ https://shopify.dev │
83
+ * │ │
84
+ * │ Link: https://shopify.com │
85
+ * │ │
86
+ * ╰──────────────────────────────────────────────────────────╯
87
+ * ```
88
+ */
89
+ export declare function renderSuccess(options: RenderAlertOptions): void;
90
+ /**
91
+ * Renders a warning banner to the console.
92
+ *
93
+ * Basic:
94
+ *
95
+ * ```
96
+ * ╭─ warning ────────────────────────────────────────────────╮
97
+ * │ │
98
+ * │ Title │
99
+ * │ │
100
+ * ╰──────────────────────────────────────────────────────────╯
101
+ * ```
102
+ *
103
+ * Complete:
104
+ * ```
105
+ * ╭─ warning ────────────────────────────────────────────────╮
106
+ * │ │
107
+ * │ Title │
108
+ * │ │
109
+ * │ Body │
110
+ * │ │
111
+ * │ Next steps │
112
+ * │ • Run cd santorini-goods │
113
+ * │ • To preview your project, run npm app dev │
114
+ * │ • To add extensions, run npm generate extension │
115
+ * │ │
116
+ * │ Reference │
117
+ * │ • Run npm shopify help │
118
+ * │ • Press 'return' to open the dev docs: │
119
+ * │ https://shopify.dev │
120
+ * │ │
121
+ * │ Link: https://shopify.com │
122
+ * │ │
123
+ * ╰──────────────────────────────────────────────────────────╯
124
+ * ```
125
+ */
126
+ export declare function renderWarning(options: RenderAlertOptions): void;
127
+ /**
128
+ * Renders a Fatal error to the console inside a banner.
129
+ *
130
+ * ```
131
+ * ╭─ error ──────────────────────────────────────────────────╮
132
+ * │ │
133
+ * │ Couldn't connect to the Shopify Partner Dashboard. │
134
+ * │ │
135
+ * │ Check your internet connection and try again. │
136
+ * │ │
137
+ * ╰──────────────────────────────────────────────────────────╯
138
+ * ```
139
+ */
140
+ export declare function renderFatalError(error: Fatal): void;
141
+ /**
142
+ * Renders a generic error to the console inside a banner.
143
+ *
144
+ * ```
145
+ * ╭─ error ──────────────────────────────────────────────────╮
146
+ * │ │
147
+ * │ Something went wrong. │
148
+ * │ │
149
+ * │ Check your internet connection. │
150
+ * │ │
151
+ * ╰──────────────────────────────────────────────────────────╯
152
+ * ```
153
+ */
154
+ export declare function renderError(options: ErrorProps): void;
155
+ export {};