@shopify/cli-kit 3.30.1 → 3.31.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.
- package/dist/api/partners.js +5 -0
- package/dist/api/partners.js.map +1 -1
- package/dist/content-tokens.js +3 -1
- package/dist/content-tokens.js.map +1 -1
- package/dist/environment/fqdn.d.ts +6 -0
- package/dist/environment/fqdn.js +13 -2
- package/dist/environment/fqdn.js.map +1 -1
- package/dist/http/fetch.js +4 -0
- package/dist/http/fetch.js.map +1 -1
- package/dist/output.js +1 -1
- package/dist/output.js.map +1 -1
- package/dist/private/common/lodash.d.ts +47 -0
- package/dist/private/common/lodash.js +2 -0
- package/dist/private/common/lodash.js.map +1 -0
- package/dist/private/node/ui/components/Alert.test.js +3 -3
- package/dist/private/node/ui/components/Alert.test.js.map +1 -1
- package/dist/private/node/ui/components/Banner.js +5 -21
- package/dist/private/node/ui/components/Banner.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +0 -1
- package/dist/private/node/ui/components/ConcurrentOutput.js +6 -16
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.test.js +3 -2
- package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.js +2 -2
- package/dist/private/node/ui/components/FatalError.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.test.js +10 -10
- package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
- package/dist/private/node/ui/components/Link.js +1 -1
- package/dist/private/node/ui/components/Link.js.map +1 -1
- package/dist/private/node/ui/components/Link.test.js +1 -1
- package/dist/private/node/ui/components/Link.test.js.map +1 -1
- package/dist/private/node/ui/components/Prompt.js +1 -1
- package/dist/private/node/ui/components/Prompt.js.map +1 -1
- package/dist/private/node/ui/components/Prompt.test.js +4 -2
- package/dist/private/node/ui/components/Prompt.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.js +3 -1
- package/dist/private/node/ui/components/SelectInput.js.map +1 -1
- package/dist/private/node/ui/components/Table.js +1 -1
- package/dist/private/node/ui/components/Table.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.d.ts +10 -0
- package/dist/private/node/ui/components/Tasks.js +27 -0
- package/dist/private/node/ui/components/Tasks.js.map +1 -0
- package/dist/private/node/ui/components/Tasks.test.d.ts +1 -0
- package/dist/private/node/ui/components/Tasks.test.js +50 -0
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -0
- package/dist/private/node/ui/components/TextAnimation.d.ts +2 -4
- package/dist/private/node/ui/components/TextAnimation.js +24 -35
- package/dist/private/node/ui/components/TextAnimation.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.test.js +1 -1
- package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
- package/dist/private/node/ui/hooks/use-async-and-unmount.d.ts +6 -0
- package/dist/private/node/ui/hooks/use-async-and-unmount.js +17 -0
- package/dist/private/node/ui/hooks/use-async-and-unmount.js.map +1 -0
- package/dist/private/node/ui/hooks/use-layout.d.ts +3 -0
- package/dist/private/node/ui/hooks/use-layout.js +21 -0
- package/dist/private/node/ui/hooks/use-layout.js.map +1 -0
- package/dist/private/node/ui.d.ts +11 -0
- package/dist/private/node/ui.js +1 -1
- package/dist/private/node/ui.js.map +1 -1
- package/dist/public/common/array.d.ts +20 -0
- package/dist/public/common/array.js +27 -0
- package/dist/public/common/array.js.map +1 -1
- package/dist/public/common/collection.d.ts +23 -0
- package/dist/public/common/collection.js +29 -0
- package/dist/public/common/collection.js.map +1 -0
- package/dist/public/common/function.d.ts +30 -0
- package/dist/public/common/function.js +40 -0
- package/dist/public/common/function.js.map +1 -0
- package/dist/public/common/lang.d.ts +16 -0
- package/dist/public/common/lang.js +22 -0
- package/dist/public/common/lang.js.map +1 -0
- package/dist/public/common/object.d.ts +22 -0
- package/dist/public/common/object.js +28 -0
- package/dist/public/common/object.js.map +1 -1
- package/dist/public/node/base-command.d.ts +1 -0
- package/dist/public/node/base-command.js +13 -0
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/ui.d.ts +5 -0
- package/dist/public/node/ui.js +7 -0
- package/dist/public/node/ui.js.map +1 -1
- package/dist/session.js +8 -5
- package/dist/session.js.map +1 -1
- package/dist/string.d.ts +0 -6
- package/dist/string.js +0 -11
- package/dist/string.js.map +1 -1
- package/dist/testing/ui.d.ts +1 -0
- package/dist/testing/ui.js +4 -0
- package/dist/testing/ui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAnimation.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TextAnimation.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"TextAnimation.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TextAnimation.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AACxD,OAAO,QAAQ,MAAM,iBAAiB,CAAA;AAMtC,SAAS,OAAO,CAAC,IAAY,EAAE,KAAa;IAC1C,MAAM,GAAG,GAAG,CAAC,GAAG,KAAK,CAAA;IACrB,MAAM,SAAS,GAAG,EAAC,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAC,CAAA;IAC9C,MAAM,UAAU,GAAG,EAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAC,CAAA;IACrD,OAAO,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,IAAI,EAAE,EAAC,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAC,CAAC,CAAA;AACvF,CAAC;AAED;;GAEG;AACH,MAAM,aAAa,GAAoB,CAAC,EAAC,IAAI,EAAC,EAAe,EAAE;IAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;IACvB,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IACxD,MAAM,OAAO,GAAG,MAAM,EAAkB,CAAA;IAExC,MAAM,eAAe,GAAG,GAAG,EAAE;QAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,GAAG,CAAC,CAAA;QAClC,KAAK,CAAC,OAAO,GAAG,QAAQ,CAAA;QAExB,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;QAE9C,OAAO,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAChC,eAAe,EAAE,CAAA;QACnB,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACb,eAAe,EAAE,CAAA;QAEjB,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC/B,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,oBAAC,IAAI,QAAE,aAAa,CAAQ,CAAA;AACrC,CAAC,CAAA;AAED,OAAO,EAAC,aAAa,EAAC,CAAA","sourcesContent":["/* eslint-disable id-length */\nimport {Text} from 'ink'\nimport React, {useEffect, useRef, useState} from 'react'\nimport gradient from 'gradient-string'\n\ninterface Props {\n text: string\n}\n\nfunction rainbow(text: string, frame: number) {\n const hue = 5 * frame\n const leftColor = {h: hue % 360, s: 0.8, v: 1}\n const rightColor = {h: (hue + 1) % 360, s: 0.8, v: 1}\n return gradient(leftColor, rightColor)(text, {interpolation: 'hsv', hsvSpin: 'long'})\n}\n\n/**\n * `TextAnimation` applies a rainbow animation to text.\n */\nconst TextAnimation: React.FC<Props> = ({text}): JSX.Element => {\n const frame = useRef(0)\n const [renderedFrame, setRenderedFrame] = useState(text)\n const timeout = useRef<NodeJS.Timeout>()\n\n const renderAnimation = () => {\n const newFrame = frame.current + 1\n frame.current = newFrame\n\n setRenderedFrame(rainbow(text, frame.current))\n\n timeout.current = setTimeout(() => {\n renderAnimation()\n }, 35)\n }\n\n useEffect(() => {\n renderAnimation()\n\n return () => {\n clearTimeout(timeout.current)\n }\n }, [])\n\n return <Text>{renderedFrame}</Text>\n}\n\nexport {TextAnimation}\n"]}
|
|
@@ -33,7 +33,7 @@ describe('TokenizedText', async () => {
|
|
|
33
33
|
];
|
|
34
34
|
const { output } = renderString(React.createElement(TokenizedText, { item: item }));
|
|
35
35
|
expect(unstyled(output)).toMatchInlineSnapshot(`
|
|
36
|
-
"Run \`cd verification-app\` Example (https://example.com)! my-app
|
|
36
|
+
"Run \`cd verification-app\` Example ( https://example.com )! my-app
|
|
37
37
|
• Item 1
|
|
38
38
|
• Item 2
|
|
39
39
|
• Item 3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenizedText.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TokenizedText.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAA;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,QAAQ,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;IACnC,IAAI,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,IAAI,GAAG;YACX,KAAK;YACL;gBACE,OAAO,EAAE,qBAAqB;aAC/B;YACD;gBACE,IAAI,EAAE;oBACJ,GAAG,EAAE,qBAAqB;oBAC1B,KAAK,EAAE,SAAS;iBACjB;aACF;YACD;gBACE,IAAI,EAAE,GAAG;aACV;YACD;gBACE,SAAS,EAAE,QAAQ;aACpB;YACD;gBACE,IAAI,EAAE;oBACJ,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;iBACtC;aACF;YACD;gBACE,QAAQ,EAAE,uBAAuB;aAClC;SACF,CAAA;QAED,MAAM,EAAC,MAAM,EAAC,GAAG,YAAY,CAAC,oBAAC,aAAa,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,CAAA;QAE5D,MAAM,CAAC,QAAQ,CAAC,MAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;KAM/C,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {TokenizedText} from './TokenizedText.js'\nimport {renderString} from '../../ui.js'\nimport {unstyled} from '../../../../output.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\n\ndescribe('TokenizedText', async () => {\n test('renders arrays of items separated by spaces', async () => {\n const item = [\n 'Run',\n {\n command: 'cd verification-app',\n },\n {\n link: {\n url: 'https://example.com',\n label: 'Example',\n },\n },\n {\n char: '!',\n },\n {\n userInput: 'my-app',\n },\n {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n {\n filePath: 'src/this/is/a/test.js',\n },\n ]\n\n const {output} = renderString(<TokenizedText item={item} />)\n\n expect(unstyled(output!)).toMatchInlineSnapshot(`\n \"Run \\`cd verification-app\\` Example (https://example.com)! my-app\n • Item 1\n • Item 2\n • Item 3\n \\\\\"src/this/is/a/test.js\\\\\"\"\n `)\n })\n})\n"]}
|
|
1
|
+
{"version":3,"file":"TokenizedText.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TokenizedText.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAA;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,QAAQ,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;IACnC,IAAI,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,IAAI,GAAG;YACX,KAAK;YACL;gBACE,OAAO,EAAE,qBAAqB;aAC/B;YACD;gBACE,IAAI,EAAE;oBACJ,GAAG,EAAE,qBAAqB;oBAC1B,KAAK,EAAE,SAAS;iBACjB;aACF;YACD;gBACE,IAAI,EAAE,GAAG;aACV;YACD;gBACE,SAAS,EAAE,QAAQ;aACpB;YACD;gBACE,IAAI,EAAE;oBACJ,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;iBACtC;aACF;YACD;gBACE,QAAQ,EAAE,uBAAuB;aAClC;SACF,CAAA;QAED,MAAM,EAAC,MAAM,EAAC,GAAG,YAAY,CAAC,oBAAC,aAAa,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,CAAA;QAE5D,MAAM,CAAC,QAAQ,CAAC,MAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;KAM/C,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {TokenizedText} from './TokenizedText.js'\nimport {renderString} from '../../ui.js'\nimport {unstyled} from '../../../../output.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\n\ndescribe('TokenizedText', async () => {\n test('renders arrays of items separated by spaces', async () => {\n const item = [\n 'Run',\n {\n command: 'cd verification-app',\n },\n {\n link: {\n url: 'https://example.com',\n label: 'Example',\n },\n },\n {\n char: '!',\n },\n {\n userInput: 'my-app',\n },\n {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n {\n filePath: 'src/this/is/a/test.js',\n },\n ]\n\n const {output} = renderString(<TokenizedText item={item} />)\n\n expect(unstyled(output!)).toMatchInlineSnapshot(`\n \"Run \\`cd verification-app\\` Example ( https://example.com )! my-app\n • Item 1\n • Item 2\n • Item 3\n \\\\\"src/this/is/a/test.js\\\\\"\"\n `)\n })\n})\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useApp } from 'ink';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
export default function useEffectAsync(asyncFunction, { onFulfilled = () => { }, onRejected = () => { } }) {
|
|
4
|
+
const { exit: unmountInk } = useApp();
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
asyncFunction()
|
|
7
|
+
.then(() => {
|
|
8
|
+
onFulfilled();
|
|
9
|
+
unmountInk();
|
|
10
|
+
})
|
|
11
|
+
.catch((error) => {
|
|
12
|
+
onRejected(error);
|
|
13
|
+
unmountInk(error);
|
|
14
|
+
});
|
|
15
|
+
}, []);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=use-async-and-unmount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-async-and-unmount.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/hooks/use-async-and-unmount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAA;AAO/B,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,aAAqC,EACrC,EAAC,WAAW,GAAG,GAAG,EAAE,GAAE,CAAC,EAAE,UAAU,GAAG,GAAG,EAAE,GAAE,CAAC,EAAU;IAExD,MAAM,EAAC,IAAI,EAAE,UAAU,EAAC,GAAG,MAAM,EAAE,CAAA;IAEnC,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,EAAE;aACZ,IAAI,CAAC,GAAG,EAAE;YACT,WAAW,EAAE,CAAA;YACb,UAAU,EAAE,CAAA;QACd,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,UAAU,CAAC,KAAK,CAAC,CAAA;YACjB,UAAU,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC,CAAC,CAAA;IACN,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC","sourcesContent":["import {useApp} from 'ink'\nimport {useEffect} from 'react'\n\ninterface Options {\n onFulfilled?: () => unknown\n onRejected?: (error: Error) => void\n}\n\nexport default function useEffectAsync(\n asyncFunction: () => Promise<unknown>,\n {onFulfilled = () => {}, onRejected = () => {}}: Options,\n) {\n const {exit: unmountInk} = useApp()\n\n useEffect(() => {\n asyncFunction()\n .then(() => {\n onFulfilled()\n unmountInk()\n })\n .catch((error) => {\n onRejected(error)\n unmountInk(error)\n })\n }, [])\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useStdout } from 'ink';
|
|
2
|
+
const MIN_WIDTH = 80;
|
|
3
|
+
export default function useLayout() {
|
|
4
|
+
const { stdout } = useStdout();
|
|
5
|
+
const fullWidth = stdout?.columns ?? MIN_WIDTH;
|
|
6
|
+
const twoThirdsOfWidth = Math.floor((fullWidth / 3) * 2);
|
|
7
|
+
let width;
|
|
8
|
+
if (fullWidth <= MIN_WIDTH) {
|
|
9
|
+
width = fullWidth;
|
|
10
|
+
}
|
|
11
|
+
else if (twoThirdsOfWidth < MIN_WIDTH) {
|
|
12
|
+
width = MIN_WIDTH;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
width = twoThirdsOfWidth;
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
width,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=use-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-layout.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/hooks/use-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,KAAK,CAAA;AAE7B,MAAM,SAAS,GAAG,EAAE,CAAA;AAEpB,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,MAAM,EAAC,MAAM,EAAC,GAAG,SAAS,EAAE,CAAA;IAE5B,MAAM,SAAS,GAAG,MAAM,EAAE,OAAO,IAAI,SAAS,CAAA;IAC9C,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IACxD,IAAI,KAAK,CAAA;IAET,IAAI,SAAS,IAAI,SAAS,EAAE;QAC1B,KAAK,GAAG,SAAS,CAAA;KAClB;SAAM,IAAI,gBAAgB,GAAG,SAAS,EAAE;QACvC,KAAK,GAAG,SAAS,CAAA;KAClB;SAAM;QACL,KAAK,GAAG,gBAAgB,CAAA;KACzB;IAED,OAAO;QACL,KAAK;KACN,CAAA;AACH,CAAC","sourcesContent":["import {useStdout} from 'ink'\n\nconst MIN_WIDTH = 80\n\nexport default function useLayout() {\n const {stdout} = useStdout()\n\n const fullWidth = stdout?.columns ?? MIN_WIDTH\n const twoThirdsOfWidth = Math.floor((fullWidth / 3) * 2)\n let width\n\n if (fullWidth <= MIN_WIDTH) {\n width = fullWidth\n } else if (twoThirdsOfWidth < MIN_WIDTH) {\n width = MIN_WIDTH\n } else {\n width = twoThirdsOfWidth\n }\n\n return {\n width,\n }\n}\n"]}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { Logger, LogLevel } from '../../output.js';
|
|
2
3
|
import { Props as PromptProps } from '../../private/node/ui/components/Prompt.js';
|
|
3
4
|
import { ReactElement } from 'react';
|
|
4
5
|
import { RenderOptions } from 'ink';
|
|
6
|
+
import { EventEmitter } from 'events';
|
|
5
7
|
export declare function renderOnce(element: JSX.Element, logLevel?: LogLevel, logger?: Logger): void;
|
|
6
8
|
export declare function render(element: JSX.Element, options?: RenderOptions): Promise<void>;
|
|
7
9
|
interface Instance {
|
|
8
10
|
output: string | undefined;
|
|
9
11
|
unmount: () => void;
|
|
10
12
|
}
|
|
13
|
+
export declare class OutputStream extends EventEmitter {
|
|
14
|
+
columns: number;
|
|
15
|
+
private _lastFrame?;
|
|
16
|
+
constructor(options: {
|
|
17
|
+
columns: number;
|
|
18
|
+
});
|
|
19
|
+
write: (frame: string) => void;
|
|
20
|
+
lastFrame: () => string | undefined;
|
|
21
|
+
}
|
|
11
22
|
export declare const renderString: (element: ReactElement) => Instance;
|
|
12
23
|
export declare function prompt<T>(options: Omit<PromptProps<T>, 'onChoose'>): Promise<T>;
|
|
13
24
|
export {};
|
package/dist/private/node/ui.js
CHANGED
|
@@ -18,7 +18,7 @@ export function render(element, options) {
|
|
|
18
18
|
return waitUntilExit();
|
|
19
19
|
}
|
|
20
20
|
const TEST_TERMINAL_WIDTH = 80;
|
|
21
|
-
class OutputStream extends EventEmitter {
|
|
21
|
+
export class OutputStream extends EventEmitter {
|
|
22
22
|
constructor(options) {
|
|
23
23
|
super();
|
|
24
24
|
this.write = (frame) => {
|
|
@@ -1 +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;AAChG,OAAO,MAA8B,MAAM,4CAA4C,CAAA;AACvF,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAC,MAAM,IAAI,SAAS,EAAgB,MAAM,KAAK,CAAA;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAA;AAEnC,MAAM,UAAU,UAAU,CAAC,OAAoB,EAAE,WAAqB,MAAM,EAAE,SAAiB,UAAU;IACvG,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IAE/C,IAAI,MAAM,EAAE;QACV,IAAI,UAAU,EAAE;YAAE,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC9C,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KACjD;IAED,OAAO,EAAE,CAAA;AACX,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAoB,EAAE,OAAuB;IAClE,MAAM,EAAC,aAAa,EAAC,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACnD,OAAO,aAAa,EAAE,CAAA;AACxB,CAAC;AAOD,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAC9B,MAAM,YAAa,SAAQ,YAAY;
|
|
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;AAChG,OAAO,MAA8B,MAAM,4CAA4C,CAAA;AACvF,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAC,MAAM,IAAI,SAAS,EAAgB,MAAM,KAAK,CAAA;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAA;AAEnC,MAAM,UAAU,UAAU,CAAC,OAAoB,EAAE,WAAqB,MAAM,EAAE,SAAiB,UAAU;IACvG,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IAE/C,IAAI,MAAM,EAAE;QACV,IAAI,UAAU,EAAE;YAAE,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC9C,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KACjD;IAED,OAAO,EAAE,CAAA;AACX,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAoB,EAAE,OAAuB;IAClE,MAAM,EAAC,aAAa,EAAC,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACnD,OAAO,aAAa,EAAE,CAAA;AACxB,CAAC;AAOD,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAC9B,MAAM,OAAO,YAAa,SAAQ,YAAY;IAI5C,YAAY,OAA0B;QACpC,KAAK,EAAE,CAAA;QAIT,UAAK,GAAG,CAAC,KAAa,EAAE,EAAE;YACxB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;QACzB,CAAC,CAAA;QAED,cAAS,GAAG,GAAG,EAAE;YACf,OAAO,IAAI,CAAC,UAAU,CAAA;QACxB,CAAC,CAAA;QATC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;IAChC,CAAC;CASF;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAqB,EAAY,EAAE;IAC9D,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,EAAC,OAAO,EAAE,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;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAI,OAAyC;IACvE,IAAI,eAAe,GAAwB,GAAG,EAAE,GAAE,CAAC,CAAA;IAEnD,MAAM,eAAe,GAAG,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,EAAE;QACjD,eAAe,GAAG,OAAO,CAAA;IAC3B,CAAC,CAAC,CAAA;IAEF,MAAM,KAAK,GAAG;QACZ,GAAG,OAAO;QACV,QAAQ,EAAE,eAAe;KAC1B,CAAA;IAED,MAAM,MAAM,CAAC,oBAAC,MAAM,OAAK,KAAK,GAAI,EAAE,EAAC,WAAW,EAAE,KAAK,EAAC,CAAC,CAAA;IAEzD,OAAO,eAAe,CAAA;AACxB,CAAC","sourcesContent":["import {isUnitTest} from '../../environment/local.js'\nimport {collectLog, consoleLog, Logger, LogLevel, outputWhereAppropriate} from '../../output.js'\nimport Prompt, {Props as PromptProps} from '../../private/node/ui/components/Prompt.js'\nimport React, {ReactElement} from 'react'\nimport {render as inkRender, RenderOptions} from 'ink'\nimport {EventEmitter} from 'events'\n\nexport function renderOnce(element: JSX.Element, logLevel: LogLevel = 'info', logger: Logger = consoleLog) {\n const {output, unmount} = renderString(element)\n\n if (output) {\n if (isUnitTest()) collectLog(logLevel, output)\n outputWhereAppropriate(logLevel, logger, output)\n }\n\n unmount()\n}\n\nexport function render(element: JSX.Element, options?: RenderOptions) {\n const {waitUntilExit} = inkRender(element, options)\n return waitUntilExit()\n}\n\ninterface Instance {\n output: string | undefined\n unmount: () => void\n}\n\nconst TEST_TERMINAL_WIDTH = 80\nexport class OutputStream extends EventEmitter {\n columns: number\n private _lastFrame?: string\n\n constructor(options: {columns: number}) {\n super()\n this.columns = options.columns\n }\n\n write = (frame: string) => {\n this._lastFrame = frame\n }\n\n lastFrame = () => {\n return this._lastFrame\n }\n}\n\nexport const renderString = (element: ReactElement): Instance => {\n const stdout = new OutputStream({columns: 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\nexport async function prompt<T>(options: Omit<PromptProps<T>, 'onChoose'>) {\n let onChooseResolve: (choice: T) => void = () => {}\n\n const onChoosePromise = new Promise<T>((resolve) => {\n onChooseResolve = resolve\n })\n\n const props = {\n ...options,\n onChoose: onChooseResolve,\n }\n\n await render(<Prompt {...props} />, {exitOnCtrlC: false})\n\n return onChoosePromise\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { List, ValueIteratee } from 'lodash';
|
|
1
2
|
/**
|
|
2
3
|
* Takes a random value from an array.
|
|
3
4
|
* @param array - Array from which we'll select a random item.
|
|
@@ -15,3 +16,22 @@ export declare function getArrayRejectingUndefined<T>(array: (T | undefined)[]):
|
|
|
15
16
|
* @returns True if the array contains duplicates.
|
|
16
17
|
*/
|
|
17
18
|
export declare function getArrayContainsDuplicates<T>(array: T[]): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* This method is like `_.uniq` except that it accepts `iteratee` which is
|
|
21
|
+
* invoked for each element in `array` to generate the criterion by which
|
|
22
|
+
* uniqueness is computed. The iteratee is invoked with one argument: (value).
|
|
23
|
+
*
|
|
24
|
+
* @param array - The array to inspect.
|
|
25
|
+
* @param iteratee - The iteratee invoked per element.
|
|
26
|
+
* @returns Returns the new duplicate free array.
|
|
27
|
+
*/
|
|
28
|
+
export declare function uniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
|
|
29
|
+
/**
|
|
30
|
+
* Creates an array of `array` values not included in the other provided arrays using SameValueZero for
|
|
31
|
+
* equality comparisons. The order and references of result values are determined by the first array.
|
|
32
|
+
*
|
|
33
|
+
* @param array - The array to inspect.
|
|
34
|
+
* @param values - The arrays of values to exclude.
|
|
35
|
+
* @returns Returns the new array of filtered values.
|
|
36
|
+
*/
|
|
37
|
+
export declare function difference<T>(array: List<T> | null | undefined, ...values: List<T>[]): T[];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
1
3
|
/**
|
|
2
4
|
* Takes a random value from an array.
|
|
3
5
|
* @param array - Array from which we'll select a random item.
|
|
@@ -21,4 +23,29 @@ export function getArrayRejectingUndefined(array) {
|
|
|
21
23
|
export function getArrayContainsDuplicates(array) {
|
|
22
24
|
return array.length !== new Set(array).size;
|
|
23
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* This method is like `_.uniq` except that it accepts `iteratee` which is
|
|
28
|
+
* invoked for each element in `array` to generate the criterion by which
|
|
29
|
+
* uniqueness is computed. The iteratee is invoked with one argument: (value).
|
|
30
|
+
*
|
|
31
|
+
* @param array - The array to inspect.
|
|
32
|
+
* @param iteratee - The iteratee invoked per element.
|
|
33
|
+
* @returns Returns the new duplicate free array.
|
|
34
|
+
*/
|
|
35
|
+
export function uniqBy(array, iteratee) {
|
|
36
|
+
const lodashUniqBy = require('lodash/uniqBy');
|
|
37
|
+
return lodashUniqBy(array, iteratee);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates an array of `array` values not included in the other provided arrays using SameValueZero for
|
|
41
|
+
* equality comparisons. The order and references of result values are determined by the first array.
|
|
42
|
+
*
|
|
43
|
+
* @param array - The array to inspect.
|
|
44
|
+
* @param values - The arrays of values to exclude.
|
|
45
|
+
* @returns Returns the new array of filtered values.
|
|
46
|
+
*/
|
|
47
|
+
export function difference(array, ...values) {
|
|
48
|
+
const lodashDifference = require('lodash/difference');
|
|
49
|
+
return lodashDifference(array, ...values);
|
|
50
|
+
}
|
|
24
51
|
//# sourceMappingURL=array.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/public/common/array.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAI,KAAU;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAE,CAAA;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAwB;IACpE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAmC,CAAA;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAU;IACtD,OAAO,KAAK,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAA;AAC7C,CAAC","sourcesContent":["/**\n * Takes a random value from an array.\n * @param array - Array from which we'll select a random item.\n * @returns A random element from the array.\n */\nexport function takeRandomFromArray<T>(array: T[]): T {\n return array[Math.floor(Math.random() * array.length)]!\n}\n\n/**\n * Returns a copy of the array deleting the elemements that are undefined.\n * @param array - The array whose undefined will be deleted.\n * @returns A copy of the array with the undefined elements deleted.\n */\nexport function getArrayRejectingUndefined<T>(array: (T | undefined)[]): T[] {\n return array.filter((item) => item !== undefined) as Exclude<T, null | undefined>[]\n}\n\n/**\n * Returns true if an array contains duplicates.\n * @returns True if the array contains duplicates.\n */\nexport function getArrayContainsDuplicates<T>(array: T[]): boolean {\n return array.length !== new Set(array).size\n}\n"]}
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/public/common/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAGzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAI,KAAU;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAE,CAAA;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAwB;IACpE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAmC,CAAA;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAU;IACtD,OAAO,KAAK,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAA;AAC7C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAAI,KAAiC,EAAE,QAA0B;IACrF,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAC7C,OAAO,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAI,KAAiC,EAAE,GAAG,MAAiB;IACnF,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACrD,OAAO,gBAAgB,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import {createRequire} from 'node:module'\nimport type {List, ValueIteratee} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Takes a random value from an array.\n * @param array - Array from which we'll select a random item.\n * @returns A random element from the array.\n */\nexport function takeRandomFromArray<T>(array: T[]): T {\n return array[Math.floor(Math.random() * array.length)]!\n}\n\n/**\n * Returns a copy of the array deleting the elemements that are undefined.\n * @param array - The array whose undefined will be deleted.\n * @returns A copy of the array with the undefined elements deleted.\n */\nexport function getArrayRejectingUndefined<T>(array: (T | undefined)[]): T[] {\n return array.filter((item) => item !== undefined) as Exclude<T, null | undefined>[]\n}\n\n/**\n * Returns true if an array contains duplicates.\n * @returns True if the array contains duplicates.\n */\nexport function getArrayContainsDuplicates<T>(array: T[]): boolean {\n return array.length !== new Set(array).size\n}\n\n/**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The iteratee is invoked with one argument: (value).\n *\n * @param array - The array to inspect.\n * @param iteratee - The iteratee invoked per element.\n * @returns Returns the new duplicate free array.\n */\nexport function uniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[] {\n const lodashUniqBy = require('lodash/uniqBy')\n return lodashUniqBy(array, iteratee)\n}\n\n/**\n * Creates an array of `array` values not included in the other provided arrays using SameValueZero for\n * equality comparisons. The order and references of result values are determined by the first array.\n *\n * @param array - The array to inspect.\n * @param values - The arrays of values to exclude.\n * @returns Returns the new array of filtered values.\n */\nexport function difference<T>(array: List<T> | null | undefined, ...values: List<T>[]): T[] {\n const lodashDifference = require('lodash/difference')\n return lodashDifference(array, ...values)\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { List, ValueIteratee } from 'lodash';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an object composed of keys generated from the results of running each element of collection through
|
|
4
|
+
* iteratee. The corresponding value of each key is an array of the elements responsible for generating the
|
|
5
|
+
* key. The iteratee is invoked with one argument: (value).
|
|
6
|
+
*
|
|
7
|
+
* @param collection - The collection to iterate over.
|
|
8
|
+
* @param iteratee - The function invoked per iteration.
|
|
9
|
+
* @returns Returns the composed aggregate object.
|
|
10
|
+
*/
|
|
11
|
+
export declare function groupBy<T>(collection: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): {
|
|
12
|
+
[index: string]: T[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,
|
|
16
|
+
* while the second of which contains elements predicate returns falsey for.
|
|
17
|
+
* The predicate is invoked with three arguments: (value, index|key, collection).
|
|
18
|
+
*
|
|
19
|
+
* @param collection - The collection to iterate over.
|
|
20
|
+
* @param callback - The function called per iteration.
|
|
21
|
+
* @returns Returns the array of grouped elements.
|
|
22
|
+
*/
|
|
23
|
+
export declare function partition<T>(collection: List<T> | null | undefined, callback: ValueIteratee<T>): [T[], T[]];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* Creates an object composed of keys generated from the results of running each element of collection through
|
|
5
|
+
* iteratee. The corresponding value of each key is an array of the elements responsible for generating the
|
|
6
|
+
* key. The iteratee is invoked with one argument: (value).
|
|
7
|
+
*
|
|
8
|
+
* @param collection - The collection to iterate over.
|
|
9
|
+
* @param iteratee - The function invoked per iteration.
|
|
10
|
+
* @returns Returns the composed aggregate object.
|
|
11
|
+
*/
|
|
12
|
+
export function groupBy(collection, iteratee) {
|
|
13
|
+
const lodashBroupBy = require('lodash/groupBy');
|
|
14
|
+
return lodashBroupBy(collection, iteratee);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,
|
|
18
|
+
* while the second of which contains elements predicate returns falsey for.
|
|
19
|
+
* The predicate is invoked with three arguments: (value, index|key, collection).
|
|
20
|
+
*
|
|
21
|
+
* @param collection - The collection to iterate over.
|
|
22
|
+
* @param callback - The function called per iteration.
|
|
23
|
+
* @returns Returns the array of grouped elements.
|
|
24
|
+
*/
|
|
25
|
+
export function partition(collection, callback) {
|
|
26
|
+
const lodashPartition = require('lodash/partition');
|
|
27
|
+
return lodashPartition(collection, callback);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/public/common/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAGzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CACrB,UAA2C,EAC3C,QAA2B;IAI3B,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC/C,OAAO,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;AAC5C,CAAC;AAED;;;;;;;;GAQG;AAEH,MAAM,UAAU,SAAS,CAAI,UAAsC,EAAE,QAA0B;IAC7F,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACnD,OAAO,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;AAC9C,CAAC","sourcesContent":["import {createRequire} from 'node:module'\nimport type {List, ValueIteratee} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Creates an object composed of keys generated from the results of running each element of collection through\n * iteratee. The corresponding value of each key is an array of the elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @param collection - The collection to iterate over.\n * @param iteratee - The function invoked per iteration.\n * @returns Returns the composed aggregate object.\n */\nexport function groupBy<T>(\n collection: ArrayLike<T> | null | undefined,\n iteratee?: ValueIteratee<T>,\n): {\n [index: string]: T[]\n} {\n const lodashBroupBy = require('lodash/groupBy')\n return lodashBroupBy(collection, iteratee)\n}\n\n/**\n * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,\n * while the second of which contains elements predicate returns falsey for.\n * The predicate is invoked with three arguments: (value, index|key, collection).\n *\n * @param collection - The collection to iterate over.\n * @param callback - The function called per iteration.\n * @returns Returns the array of grouped elements.\n */\n\nexport function partition<T>(collection: List<T> | null | undefined, callback: ValueIteratee<T>): [T[], T[]] {\n const lodashPartition = require('lodash/partition')\n return lodashPartition(collection, callback)\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DebouncedFunc, DebounceSettings } from 'lodash';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for
|
|
4
|
+
* storing the result based on the arguments provided to the memoized function. By default, the first argument
|
|
5
|
+
* provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with
|
|
6
|
+
* the this binding of the memoized function.
|
|
7
|
+
*
|
|
8
|
+
* @param func - The function to have its output memoized.
|
|
9
|
+
* @param resolver - The function to resolve the cache key.
|
|
10
|
+
* @returns Returns the new memoizing function.
|
|
11
|
+
*/
|
|
12
|
+
export declare function memoize<T extends (...args: any) => any>(func: T, resolver?: (...args: Parameters<T>) => unknown): T;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since
|
|
15
|
+
* the last time the debounced function was invoked. The debounced function comes with a cancel method to
|
|
16
|
+
* cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to
|
|
17
|
+
* indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent
|
|
18
|
+
* calls to the debounced function return the result of the last func invocation.
|
|
19
|
+
*
|
|
20
|
+
* Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only
|
|
21
|
+
* if the the debounced function is invoked more than once during the wait timeout.
|
|
22
|
+
*
|
|
23
|
+
* See David Corbacho’s article for details over the differences between _.debounce and _.throttle.
|
|
24
|
+
*
|
|
25
|
+
* @param func - The function to debounce.
|
|
26
|
+
* @param wait - The number of milliseconds to delay.
|
|
27
|
+
* @param options - The options object.
|
|
28
|
+
* @returns Returns the new debounced function.
|
|
29
|
+
*/
|
|
30
|
+
export declare function debounce<T extends (...args: any) => any>(func: T, wait?: number, options?: DebounceSettings): DebouncedFunc<T>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for
|
|
5
|
+
* storing the result based on the arguments provided to the memoized function. By default, the first argument
|
|
6
|
+
* provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with
|
|
7
|
+
* the this binding of the memoized function.
|
|
8
|
+
*
|
|
9
|
+
* @param func - The function to have its output memoized.
|
|
10
|
+
* @param resolver - The function to resolve the cache key.
|
|
11
|
+
* @returns Returns the new memoizing function.
|
|
12
|
+
*/
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
export function memoize(func, resolver) {
|
|
15
|
+
const memoize = require('lodash/memoize');
|
|
16
|
+
return memoize(func, resolver);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since
|
|
20
|
+
* the last time the debounced function was invoked. The debounced function comes with a cancel method to
|
|
21
|
+
* cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to
|
|
22
|
+
* indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent
|
|
23
|
+
* calls to the debounced function return the result of the last func invocation.
|
|
24
|
+
*
|
|
25
|
+
* Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only
|
|
26
|
+
* if the the debounced function is invoked more than once during the wait timeout.
|
|
27
|
+
*
|
|
28
|
+
* See David Corbacho’s article for details over the differences between _.debounce and _.throttle.
|
|
29
|
+
*
|
|
30
|
+
* @param func - The function to debounce.
|
|
31
|
+
* @param wait - The number of milliseconds to delay.
|
|
32
|
+
* @param options - The options object.
|
|
33
|
+
* @returns Returns the new debounced function.
|
|
34
|
+
*/
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
export function debounce(func, wait, options) {
|
|
37
|
+
const lodashDebounce = require('lodash/debounce');
|
|
38
|
+
return lodashDebounce(func, wait, options);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/public/common/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAGzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;;GASG;AACH,8DAA8D;AAC9D,MAAM,UAAU,OAAO,CAAkC,IAAO,EAAE,QAA8C;IAC9G,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACzC,OAAO,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,8DAA8D;AAC9D,MAAM,UAAU,QAAQ,CACtB,IAAO,EACP,IAAa,EACb,OAA0B;IAE1B,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACjD,OAAO,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;AAC5C,CAAC","sourcesContent":["import {createRequire} from 'node:module'\nimport type {DebouncedFunc, DebounceSettings} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for\n * storing the result based on the arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with\n * the this binding of the memoized function.\n *\n * @param func - The function to have its output memoized.\n * @param resolver - The function to resolve the cache key.\n * @returns Returns the new memoizing function.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function memoize<T extends (...args: any) => any>(func: T, resolver?: (...args: Parameters<T>) => unknown): T {\n const memoize = require('lodash/memoize')\n return memoize(func, resolver)\n}\n\n/**\n * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since\n * the last time the debounced function was invoked. The debounced function comes with a cancel method to\n * cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to\n * indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent\n * calls to the debounced function return the result of the last func invocation.\n *\n * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only\n * if the the debounced function is invoked more than once during the wait timeout.\n *\n * See David Corbacho’s article for details over the differences between _.debounce and _.throttle.\n *\n * @param func - The function to debounce.\n * @param wait - The number of milliseconds to delay.\n * @param options - The options object.\n * @returns Returns the new debounced function.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function debounce<T extends (...args: any) => any>(\n func: T,\n wait?: number,\n options?: DebounceSettings,\n): DebouncedFunc<T> {\n const lodashDebounce = require('lodash/debounce')\n return lodashDebounce(func, wait, options)\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performs a deep comparison between two values to determine if they are
|
|
3
|
+
* equivalent.
|
|
4
|
+
*
|
|
5
|
+
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
6
|
+
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
7
|
+
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
8
|
+
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
9
|
+
* nodes are **not** supported.
|
|
10
|
+
*
|
|
11
|
+
* @param value - The value to compare.
|
|
12
|
+
* @param other - The other value to compare.
|
|
13
|
+
* @returns Returns `true` if the values are equivalent, else `false`.
|
|
14
|
+
* @example
|
|
15
|
+
*/
|
|
16
|
+
export declare function isEqual(value: unknown, other: unknown): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
/**
|
|
4
|
+
* Performs a deep comparison between two values to determine if they are
|
|
5
|
+
* equivalent.
|
|
6
|
+
*
|
|
7
|
+
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
8
|
+
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
9
|
+
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
10
|
+
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
11
|
+
* nodes are **not** supported.
|
|
12
|
+
*
|
|
13
|
+
* @param value - The value to compare.
|
|
14
|
+
* @param other - The other value to compare.
|
|
15
|
+
* @returns Returns `true` if the values are equivalent, else `false`.
|
|
16
|
+
* @example
|
|
17
|
+
*/
|
|
18
|
+
export function isEqual(value, other) {
|
|
19
|
+
const lodashIsEqual = require('lodash/isEqual');
|
|
20
|
+
return lodashIsEqual(value, other);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lang.js","sourceRoot":"","sources":["../../../src/public/common/lang.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAEzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc,EAAE,KAAc;IACpD,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC/C,OAAO,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACpC,CAAC","sourcesContent":["import {createRequire} from 'node:module'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are **not** supported.\n *\n * @param value - The value to compare.\n * @param other - The other value to compare.\n * @returns Returns `true` if the values are equivalent, else `false`.\n * @example\n */\nexport function isEqual(value: unknown, other: unknown): boolean {\n const lodashIsEqual = require('lodash/isEqual')\n return lodashIsEqual(value, other)\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dictionary, ObjectIterator, ValueKeyIteratee } from 'lodash';
|
|
1
2
|
/**
|
|
2
3
|
* Deep merges the two objects and returns a new object with the merge result.
|
|
3
4
|
*
|
|
@@ -8,3 +9,24 @@
|
|
|
8
9
|
* @returns A Javascrip tobject with th emerged objects.
|
|
9
10
|
*/
|
|
10
11
|
export declare function deepMergeObjects<T1, T2>(lhs: Partial<T1>, rhs: Partial<T2>, arrayMergeStrategy?: (destinationArray: unknown[], sourceArray: unknown[]) => unknown[]): T1 & T2;
|
|
12
|
+
/**
|
|
13
|
+
* Creates an object composed of the `object` properties `predicate` returns
|
|
14
|
+
* truthy for. The predicate is invoked with two arguments: (value, key).
|
|
15
|
+
*
|
|
16
|
+
* @param object- The source object.
|
|
17
|
+
* @param predicate - The function invoked per property.
|
|
18
|
+
* @returns Returns the new object.
|
|
19
|
+
*/
|
|
20
|
+
export declare function pickBy<T, S extends T>(object: Dictionary<T> | null | undefined, predicate?: ValueKeyIteratee<T>): Dictionary<S>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates an object with the same keys as object and values generated by running each own
|
|
23
|
+
* enumerable property of object through iteratee. The iteratee function is
|
|
24
|
+
* invoked with three arguments: (value, key, object).
|
|
25
|
+
*
|
|
26
|
+
* @param object - The object to iterate over.
|
|
27
|
+
* @param callback - The function invoked per iteration.
|
|
28
|
+
* @returns Returns the new mapped object.
|
|
29
|
+
*/
|
|
30
|
+
export declare function mapValues<T extends object, TResult>(obj: T | null | undefined, callback: ObjectIterator<T, TResult>): {
|
|
31
|
+
[P in keyof T]: TResult;
|
|
32
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import deepMerge from 'deepmerge';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
2
4
|
/**
|
|
3
5
|
* Deep merges the two objects and returns a new object with the merge result.
|
|
4
6
|
*
|
|
@@ -14,4 +16,30 @@ export function deepMergeObjects(lhs, rhs, arrayMergeStrategy = unionArrayStrate
|
|
|
14
16
|
function unionArrayStrategy(destinationArray, sourceArray) {
|
|
15
17
|
return Array.from(new Set([...destinationArray, ...sourceArray]));
|
|
16
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates an object composed of the `object` properties `predicate` returns
|
|
21
|
+
* truthy for. The predicate is invoked with two arguments: (value, key).
|
|
22
|
+
*
|
|
23
|
+
* @param object- The source object.
|
|
24
|
+
* @param predicate - The function invoked per property.
|
|
25
|
+
* @returns Returns the new object.
|
|
26
|
+
*/
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
28
|
+
export function pickBy(object, predicate) {
|
|
29
|
+
const lodashPickBy = require('lodash/pickBy.js');
|
|
30
|
+
return lodashPickBy(object, predicate);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates an object with the same keys as object and values generated by running each own
|
|
34
|
+
* enumerable property of object through iteratee. The iteratee function is
|
|
35
|
+
* invoked with three arguments: (value, key, object).
|
|
36
|
+
*
|
|
37
|
+
* @param object - The object to iterate over.
|
|
38
|
+
* @param callback - The function invoked per iteration.
|
|
39
|
+
* @returns Returns the new mapped object.
|
|
40
|
+
*/
|
|
41
|
+
export function mapValues(obj, callback) {
|
|
42
|
+
const lodashMapValues = require('lodash/mapValues.js');
|
|
43
|
+
return lodashMapValues(obj, callback);
|
|
44
|
+
}
|
|
17
45
|
//# sourceMappingURL=object.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/public/common/object.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAgB,EAChB,GAAgB,EAChB,qBAAyF,kBAAkB;IAE3G,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAC,UAAU,EAAE,kBAAkB,EAAC,CAAC,CAAA;AAC9D,CAAC;AAED,SAAS,kBAAkB,CAAC,gBAA2B,EAAE,WAAsB;IAC7E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AACnE,CAAC","sourcesContent":["import deepMerge from 'deepmerge'\n\n/**\n * Deep merges the two objects and returns a new object with the merge result.\n *\n * @param lhs - One of the objects to be merged.\n * @param rhs - Another object to be merged.\n * @param arrayMergeStrategy - Strategy used to merge the array typed fields. Union strategy is used by default to avoid\n * duplicated elements.\n * @returns A Javascrip tobject with th emerged objects.\n */\nexport function deepMergeObjects<T1, T2>(\n lhs: Partial<T1>,\n rhs: Partial<T2>,\n arrayMergeStrategy: (destinationArray: unknown[], sourceArray: unknown[]) => unknown[] = unionArrayStrategy,\n): T1 & T2 {\n return deepMerge(lhs, rhs, {arrayMerge: arrayMergeStrategy})\n}\n\nfunction unionArrayStrategy(destinationArray: unknown[], sourceArray: unknown[]): unknown[] {\n return Array.from(new Set([...destinationArray, ...sourceArray]))\n}\n"]}
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/public/common/object.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAEzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAgB,EAChB,GAAgB,EAChB,qBAAyF,kBAAkB;IAE3G,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAC,UAAU,EAAE,kBAAkB,EAAC,CAAC,CAAA;AAC9D,CAAC;AAED,SAAS,kBAAkB,CAAC,gBAA2B,EAAE,WAAsB;IAC7E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AACnE,CAAC;AAED;;;;;;;GAOG;AACH,gEAAgE;AAChE,MAAM,UAAU,MAAM,CACpB,MAAwC,EACxC,SAA+B;IAE/B,MAAM,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAChD,OAAO,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CACvB,GAAyB,EACzB,QAAoC;IAEpC,MAAM,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACtD,OAAO,eAAe,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;AACvC,CAAC","sourcesContent":["import deepMerge from 'deepmerge'\nimport {Dictionary, ObjectIterator, ValueKeyIteratee} from 'lodash'\nimport {createRequire} from 'node:module'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Deep merges the two objects and returns a new object with the merge result.\n *\n * @param lhs - One of the objects to be merged.\n * @param rhs - Another object to be merged.\n * @param arrayMergeStrategy - Strategy used to merge the array typed fields. Union strategy is used by default to avoid\n * duplicated elements.\n * @returns A Javascrip tobject with th emerged objects.\n */\nexport function deepMergeObjects<T1, T2>(\n lhs: Partial<T1>,\n rhs: Partial<T2>,\n arrayMergeStrategy: (destinationArray: unknown[], sourceArray: unknown[]) => unknown[] = unionArrayStrategy,\n): T1 & T2 {\n return deepMerge(lhs, rhs, {arrayMerge: arrayMergeStrategy})\n}\n\nfunction unionArrayStrategy(destinationArray: unknown[], sourceArray: unknown[]): unknown[] {\n return Array.from(new Set([...destinationArray, ...sourceArray]))\n}\n\n/**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @param object- The source object.\n * @param predicate - The function invoked per property.\n * @returns Returns the new object.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function pickBy<T, S extends T>(\n object: Dictionary<T> | null | undefined,\n predicate?: ValueKeyIteratee<T>,\n): Dictionary<S> {\n const lodashPickBy = require('lodash/pickBy.js')\n return lodashPickBy(object, predicate)\n}\n\n/**\n * Creates an object with the same keys as object and values generated by running each own\n * enumerable property of object through iteratee. The iteratee function is\n * invoked with three arguments: (value, key, object).\n *\n * @param object - The object to iterate over.\n * @param callback - The function invoked per iteration.\n * @returns Returns the new mapped object.\n */\nexport function mapValues<T extends object, TResult>(\n obj: T | null | undefined,\n callback: ObjectIterator<T, TResult>,\n): {[P in keyof T]: TResult} {\n const lodashMapValues = require('lodash/mapValues.js')\n return lodashMapValues(obj, callback)\n}\n"]}
|
|
@@ -5,6 +5,7 @@ declare abstract class BaseCommand extends Command {
|
|
|
5
5
|
exitCode?: number | undefined;
|
|
6
6
|
}): Promise<void>;
|
|
7
7
|
protected init(): Promise<any>;
|
|
8
|
+
protected exitWithTimestampWhenEnvVariablePresent(): void;
|
|
8
9
|
protected parse<TFlags extends Interfaces.FlagOutput & {
|
|
9
10
|
path?: string;
|
|
10
11
|
verbose?: boolean;
|
|
@@ -5,6 +5,7 @@ import { Abort } from '../../error.js';
|
|
|
5
5
|
import { addPublic } from '../../metadata.js';
|
|
6
6
|
import { content, info, token } from '../../output.js';
|
|
7
7
|
import { hashString } from '../../string.js';
|
|
8
|
+
import { isTruthy } from '../../environment/utilities.js';
|
|
8
9
|
import { Command } from '@oclif/core';
|
|
9
10
|
class BaseCommand extends Command {
|
|
10
11
|
static analyticsNameOverride() {
|
|
@@ -15,12 +16,24 @@ class BaseCommand extends Command {
|
|
|
15
16
|
}
|
|
16
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
18
|
async init() {
|
|
19
|
+
this.exitWithTimestampWhenEnvVariablePresent();
|
|
18
20
|
if (!isDevelopment()) {
|
|
19
21
|
// This function runs just prior to `run`
|
|
20
22
|
await registerCleanBugsnagErrorsFromWithinPlugins(this.config);
|
|
21
23
|
}
|
|
22
24
|
return super.init();
|
|
23
25
|
}
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
27
|
+
exitWithTimestampWhenEnvVariablePresent() {
|
|
28
|
+
if (isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN)) {
|
|
29
|
+
info(`
|
|
30
|
+
SHOPIFY_CLI_TIMESTAMP_START
|
|
31
|
+
{ "timestamp": ${Date.now()} }
|
|
32
|
+
SHOPIFY_CLI_TIMESTAMP_END
|
|
33
|
+
`);
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
24
37
|
async parse(options, argv) {
|
|
25
38
|
let result = await super.parse(options, argv);
|
|
26
39
|
result = await this.resultWithPreset(result, options, argv);
|