zudoku 0.0.0-fdfe742 → 0.0.0-feat-bundled-types.1c7f1db
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/lib/components/Bootstrap.d.ts +2 -2
- package/dist/lib/components/Bootstrap.js +2 -0
- package/dist/lib/components/Bootstrap.js.map +1 -1
- package/dist/lib/components/index.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/BodyPanel.d.ts +5 -0
- package/dist/lib/plugins/openapi/playground/BodyPanel.js +22 -0
- package/dist/lib/plugins/openapi/playground/BodyPanel.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js +2 -1
- package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Headers.js +25 -25
- package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/IdentitySelector.js +1 -1
- package/dist/lib/plugins/openapi/playground/IdentitySelector.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/ParamsGrid.js +2 -2
- package/dist/lib/plugins/openapi/playground/ParamsGrid.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.js +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +3 -8
- package/dist/lib/plugins/openapi/playground/Playground.js +70 -65
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js +1 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/fileUtils.d.ts +2 -0
- package/dist/lib/plugins/openapi/playground/fileUtils.js +22 -0
- package/dist/lib/plugins/openapi/playground/fileUtils.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.d.ts +4 -1
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +29 -20
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +2 -2
- package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/useRememberSkipLoginDialog.d.ts +16 -0
- package/dist/lib/plugins/openapi/playground/useRememberSkipLoginDialog.js +10 -0
- package/dist/lib/plugins/openapi/playground/useRememberSkipLoginDialog.js.map +1 -0
- package/dist/lib/ui/CodeBlock.js +1 -1
- package/dist/lib/ui/CodeBlock.js.map +1 -1
- package/dist/lib/ui/Dialog.d.ts +3 -1
- package/dist/lib/ui/Dialog.js +2 -2
- package/dist/lib/ui/Dialog.js.map +1 -1
- package/dist/lib/util/humanFileSize.d.ts +6 -0
- package/dist/lib/util/humanFileSize.js +14 -0
- package/dist/lib/util/humanFileSize.js.map +1 -0
- package/dist/lib/util/humanFileSize.test.d.ts +1 -0
- package/dist/lib/util/humanFileSize.test.js +22 -0
- package/dist/lib/util/humanFileSize.test.js.map +1 -0
- package/lib/{Callout-CvY02DXU.js → Callout-CoVxYafP.js} +2 -2
- package/lib/{Callout-CvY02DXU.js.map → Callout-CoVxYafP.js.map} +1 -1
- package/lib/{Dialog-B53OMCvW.js → Dialog-BxpuVLh9.js} +25 -25
- package/lib/Dialog-BxpuVLh9.js.map +1 -0
- package/lib/{Markdown-m03c-TR_.js → Markdown-Cm4kj26S.js} +3 -2
- package/lib/{Markdown-m03c-TR_.js.map → Markdown-Cm4kj26S.js.map} +1 -1
- package/lib/{MdxPage-Dy5JAci3.js → MdxPage-fDGQtB5w.js} +3 -3
- package/lib/{MdxPage-Dy5JAci3.js.map → MdxPage-fDGQtB5w.js.map} +1 -1
- package/lib/{OasProvider-DfTncecV.js → OasProvider-CFBvfR3r.js} +2 -2
- package/lib/{OasProvider-DfTncecV.js.map → OasProvider-CFBvfR3r.js.map} +1 -1
- package/lib/{OperationList-DTQVxVx5.js → OperationList-Xs4KWmsh.js} +4 -4
- package/lib/{OperationList-DTQVxVx5.js.map → OperationList-Xs4KWmsh.js.map} +1 -1
- package/lib/{RouteGuard-DiCUImwp.js → RouteGuard-CZ_uLv3g.js} +2 -2
- package/lib/{RouteGuard-DiCUImwp.js.map → RouteGuard-CZ_uLv3g.js.map} +1 -1
- package/lib/{SchemaList-BoRsh_HT.js → SchemaList-BWaNlmUJ.js} +5 -5
- package/lib/{SchemaList-BoRsh_HT.js.map → SchemaList-BWaNlmUJ.js.map} +1 -1
- package/lib/{SchemaView-BpEFXAa1.js → SchemaView-DdKJt2ln.js} +3 -3
- package/lib/{SchemaView-BpEFXAa1.js.map → SchemaView-DdKJt2ln.js.map} +1 -1
- package/lib/{Slot-xguyqKKU.js → Slot-B99cbD-q.js} +2 -2
- package/lib/{Slot-xguyqKKU.js.map → Slot-B99cbD-q.js.map} +1 -1
- package/lib/{Toc-CYYLzWX_.js → Toc-Qe7A4uj_.js} +2 -2
- package/lib/{Toc-CYYLzWX_.js.map → Toc-Qe7A4uj_.js.map} +1 -1
- package/lib/{circular-CCqt6vxH.js → circular-w5eL5J8a.js} +1812 -1807
- package/lib/circular-w5eL5J8a.js.map +1 -0
- package/lib/{createServer-Fm59dJVp.js → createServer-p3yUA8Bu.js} +3648 -3493
- package/lib/createServer-p3yUA8Bu.js.map +1 -0
- package/lib/{index-DCHP-Cbn.js → index-yqBxBqxF.js} +1053 -1095
- package/lib/index-yqBxBqxF.js.map +1 -0
- package/lib/react-nprogress.esm-C2MPXjiJ.js +389 -0
- package/lib/react-nprogress.esm-C2MPXjiJ.js.map +1 -0
- package/lib/ui/CodeBlock.js +17 -16
- package/lib/ui/CodeBlock.js.map +1 -1
- package/lib/ui/Command.js +1 -1
- package/lib/ui/Dialog.js +25 -25
- package/lib/ui/Dialog.js.map +1 -1
- package/lib/zudoku.components.js +1697 -2081
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-catalog.js +1 -1
- package/lib/zudoku.plugin-api-keys.js +2 -2
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +3 -3
- package/package.json +8 -7
- package/src/lib/components/Bootstrap.tsx +4 -2
- package/src/lib/plugins/openapi/playground/BodyPanel.tsx +46 -0
- package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +4 -1
- package/src/lib/plugins/openapi/playground/Headers.tsx +110 -106
- package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +13 -11
- package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +2 -2
- package/src/lib/plugins/openapi/playground/PathParams.tsx +1 -1
- package/src/lib/plugins/openapi/playground/Playground.tsx +127 -211
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +2 -1
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +1 -1
- package/src/lib/plugins/openapi/playground/fileUtils.ts +32 -0
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +74 -39
- package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +4 -1
- package/src/lib/plugins/openapi/playground/useRememberSkipLoginDialog.tsx +20 -0
- package/src/lib/ui/CodeBlock.tsx +1 -0
- package/src/lib/ui/Dialog.tsx +11 -7
- package/src/lib/util/humanFileSize.test.ts +24 -0
- package/src/lib/util/humanFileSize.ts +16 -0
- package/dist/lib/plugins/openapi/playground/SubmitButton.d.ts +0 -7
- package/dist/lib/plugins/openapi/playground/SubmitButton.js +0 -19
- package/dist/lib/plugins/openapi/playground/SubmitButton.js.map +0 -1
- package/dist/ts.d.ts +0 -6
- package/dist/ts.js +0 -61
- package/dist/ts.js.map +0 -1
- package/lib/Dialog-B53OMCvW.js.map +0 -1
- package/lib/circular-CCqt6vxH.js.map +0 -1
- package/lib/createServer-Fm59dJVp.js.map +0 -1
- package/lib/index-DCHP-Cbn.js.map +0 -1
- package/src/lib/plugins/openapi/playground/SubmitButton.tsx +0 -70
|
@@ -32,7 +32,7 @@ export const ResultPanel = ({
|
|
|
32
32
|
}) => {
|
|
33
33
|
const status = ((queryMutation.data?.status ?? 0) / 100).toFixed(0);
|
|
34
34
|
return (
|
|
35
|
-
<div className="min-w-0 p-4 py-
|
|
35
|
+
<div className="min-w-0 p-4 py-4 bg-muted/50">
|
|
36
36
|
{queryMutation.error ? (
|
|
37
37
|
<div className="flex flex-col gap-2">
|
|
38
38
|
{showPathParamsWarning && (
|
|
@@ -83,6 +83,9 @@ export const ResultPanel = ({
|
|
|
83
83
|
headers={queryMutation.data.headers}
|
|
84
84
|
body={queryMutation.data.body}
|
|
85
85
|
url={queryMutation.data.request.url}
|
|
86
|
+
isBinary={queryMutation.data.isBinary}
|
|
87
|
+
fileName={queryMutation.data.fileName}
|
|
88
|
+
blob={queryMutation.data.blob}
|
|
86
89
|
/>
|
|
87
90
|
</TabsContent>
|
|
88
91
|
</Tabs>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import { createJSONStorage, persist } from "zustand/middleware";
|
|
3
|
+
|
|
4
|
+
type RememberSkipLoginState = {
|
|
5
|
+
skipLogin: boolean;
|
|
6
|
+
setSkipLogin: (skipLogin: boolean) => void;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const useRememberSkipLoginDialog = create<RememberSkipLoginState>()(
|
|
10
|
+
persist(
|
|
11
|
+
(set) => ({
|
|
12
|
+
skipLogin: false,
|
|
13
|
+
setSkipLogin: (skipLogin: boolean) => set({ skipLogin }),
|
|
14
|
+
}),
|
|
15
|
+
{
|
|
16
|
+
name: "remember-skip-login",
|
|
17
|
+
storage: createJSONStorage(() => sessionStorage),
|
|
18
|
+
},
|
|
19
|
+
),
|
|
20
|
+
);
|
package/src/lib/ui/CodeBlock.tsx
CHANGED
package/src/lib/ui/Dialog.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2
|
-
import { X } from "lucide-react";
|
|
3
2
|
import * as React from "react";
|
|
4
3
|
|
|
4
|
+
import { XIcon } from "lucide-react";
|
|
5
5
|
import { cn } from "../util/cn.js";
|
|
6
6
|
|
|
7
7
|
const Dialog = DialogPrimitive.Root;
|
|
@@ -29,8 +29,10 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
|
29
29
|
|
|
30
30
|
const DialogContent = React.forwardRef<
|
|
31
31
|
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
32
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
33
|
-
|
|
32
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
|
|
33
|
+
showCloseButton?: boolean;
|
|
34
|
+
}
|
|
35
|
+
>(({ className, children, showCloseButton = true, ...props }, ref) => (
|
|
34
36
|
<DialogPortal>
|
|
35
37
|
<DialogOverlay />
|
|
36
38
|
<DialogPrimitive.Content
|
|
@@ -42,10 +44,12 @@ const DialogContent = React.forwardRef<
|
|
|
42
44
|
{...props}
|
|
43
45
|
>
|
|
44
46
|
{children}
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
{showCloseButton && (
|
|
48
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
49
|
+
<XIcon className="h-4 w-4" />
|
|
50
|
+
<span className="sr-only">Close</span>
|
|
51
|
+
</DialogPrimitive.Close>
|
|
52
|
+
)}
|
|
49
53
|
</DialogPrimitive.Content>
|
|
50
54
|
</DialogPortal>
|
|
51
55
|
));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { humanFileSize } from "./humanFileSize.js";
|
|
2
|
+
|
|
3
|
+
describe("humanFileSize", () => {
|
|
4
|
+
it("should handle zero bytes", () => {
|
|
5
|
+
expect(humanFileSize(0)).toBe("0 B");
|
|
6
|
+
expect(humanFileSize()).toBe("0 B");
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it("should handle undefined bytes", () => {
|
|
10
|
+
expect(humanFileSize(undefined)).toBe("0 B");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("should handle positive bytes", () => {
|
|
14
|
+
expect(humanFileSize(200)).toBe("200 B");
|
|
15
|
+
expect(humanFileSize(1000)).toBe("1.00 kB");
|
|
16
|
+
expect(humanFileSize(1000000)).toBe("1.00 MB");
|
|
17
|
+
expect(humanFileSize(1000000000)).toBe("1.00 GB");
|
|
18
|
+
expect(humanFileSize(1000000000000)).toBe("1.00 TB");
|
|
19
|
+
expect(humanFileSize(1000000000000000)).toBe("1.00 PB");
|
|
20
|
+
expect(humanFileSize(1000000000000000000)).toBe("1.00 EB");
|
|
21
|
+
expect(humanFileSize(1000000000000000000000)).toBe("1.00 ZB");
|
|
22
|
+
expect(humanFileSize(1000000000000000000000000)).toBe("1.00 YB");
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a number of bytes to a human-readable file size string
|
|
3
|
+
* @param bytes - The number of bytes (defaults to 0)
|
|
4
|
+
* @returns A formatted string like "1.23 MB" or "456 B"
|
|
5
|
+
*/
|
|
6
|
+
export const humanFileSize = (bytes = 0) => {
|
|
7
|
+
if (bytes === 0) {
|
|
8
|
+
return "0 B";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const exponent = Math.floor(Math.log(bytes) / Math.log(1000.0));
|
|
12
|
+
const decimal = (bytes / Math.pow(1000.0, exponent)).toFixed(
|
|
13
|
+
exponent ? 2 : 0,
|
|
14
|
+
);
|
|
15
|
+
return `${decimal} ${exponent ? `${"kMGTPEZY"[exponent - 1]}B` : "B"}`;
|
|
16
|
+
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type ApiIdentity } from "../../../core/ZudokuContext.js";
|
|
2
|
-
declare const SubmitButton: ({ identities, formRef, disabled, }: {
|
|
3
|
-
identities: ApiIdentity[];
|
|
4
|
-
formRef?: React.RefObject<HTMLFormElement | null>;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default SubmitButton;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CheckIcon, ChevronDownIcon } from "lucide-react";
|
|
3
|
-
import { useFormContext } from "react-hook-form";
|
|
4
|
-
import { Button } from "zudoku/ui/Button.js";
|
|
5
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "zudoku/ui/DropdownMenu.js";
|
|
6
|
-
import { NO_IDENTITY } from "./Playground.js";
|
|
7
|
-
const SubmitButton = ({ identities, formRef, disabled, }) => {
|
|
8
|
-
const { setValue, watch } = useFormContext();
|
|
9
|
-
const formIdentity = watch("identity");
|
|
10
|
-
if (identities.length === 0) {
|
|
11
|
-
return _jsx(Button, { disabled: disabled, children: "Send" });
|
|
12
|
-
}
|
|
13
|
-
return (_jsxs("div", { className: "flex", children: [_jsx(Button, { className: "rounded-r-none inset-shadow-xs", disabled: disabled, onClick: () => formRef?.current?.requestSubmit(), children: "Send" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { disabled: disabled, className: "rounded-l-none border-l border-border/40 inset-shadow-xs w-6", size: "icon", children: _jsx(ChevronDownIcon, { className: "w-4 h-4" }) }) }), _jsx(DropdownMenuContent, { className: "w-56", align: "end", alignOffset: -150, children: [{ id: NO_IDENTITY, label: "None" }, ...identities].map((identity) => (_jsxs(DropdownMenuItem, { onClick: () => {
|
|
14
|
-
setValue("identity", identity.id);
|
|
15
|
-
formRef?.current?.requestSubmit();
|
|
16
|
-
}, children: [identity.label, formIdentity === identity.id && (_jsx(CheckIcon, { className: "ms-2", size: 16 }))] }, identity.id))) })] })] }));
|
|
17
|
-
};
|
|
18
|
-
export default SubmitButton;
|
|
19
|
-
//# sourceMappingURL=SubmitButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SubmitButton.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/playground/SubmitButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,YAAY,GAAG,CAAC,EACpB,UAAU,EACV,OAAO,EACP,QAAQ,GAKT,EAAE,EAAE;IACH,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,cAAc,EAAE,CAAC;IAC7C,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IAEvC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAC,MAAM,IAAC,QAAQ,EAAE,QAAQ,qBAAe,CAAC;IACnD,CAAC;IACD,OAAO,CACL,eAAK,SAAS,EAAC,MAAM,aACnB,KAAC,MAAM,IACL,SAAS,EAAC,gCAAgC,EAC1C,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,qBAGzC,EACT,MAAC,YAAY,eACX,KAAC,mBAAmB,IAAC,OAAO,kBAC1B,KAAC,MAAM,IACL,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAC,8DAA8D,EACxE,IAAI,EAAC,MAAM,YAEX,KAAC,eAAe,IAAC,SAAS,EAAC,SAAS,GAAG,GAChC,GACW,EACtB,KAAC,mBAAmB,IAAC,SAAS,EAAC,MAAM,EAAC,KAAK,EAAC,KAAK,EAAC,WAAW,EAAE,CAAC,GAAG,YAChE,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,UAAU,CAAC,CAAC,GAAG,CACtD,CAAC,QAAQ,EAAE,EAAE,CAAC,CACZ,MAAC,gBAAgB,IAEf,OAAO,EAAE,GAAG,EAAE;gCACZ,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;gCAClC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;4BACpC,CAAC,aAEA,QAAQ,CAAC,KAAK,EACd,YAAY,KAAK,QAAQ,CAAC,EAAE,IAAI,CAC/B,KAAC,SAAS,IAAC,SAAS,EAAC,MAAM,EAAC,IAAI,EAAE,EAAE,GAAI,CACzC,KATI,QAAQ,CAAC,EAAE,CAUC,CACpB,CACF,GACmB,IACT,IACX,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/dist/ts.d.ts
DELETED
package/dist/ts.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import path from "path";
|
|
3
|
-
import ts from "typescript";
|
|
4
|
-
/**
|
|
5
|
-
* Function to check if a TypeScript string is valid
|
|
6
|
-
* Used for tests
|
|
7
|
-
*/
|
|
8
|
-
export async function checkTypescriptString(code) {
|
|
9
|
-
const rootDir = process.cwd();
|
|
10
|
-
const inMemoryFileName = path.join(rootDir, "/src/temp.ts");
|
|
11
|
-
const configPath = ts.findConfigFile(rootDir, ts.sys.fileExists, "tsconfig.json");
|
|
12
|
-
if (!configPath) {
|
|
13
|
-
throw new Error("Could not find a valid tsconfig.json");
|
|
14
|
-
}
|
|
15
|
-
const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
16
|
-
const parsedCommandLine = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));
|
|
17
|
-
// Custom compiler host to handle in-memory file and delegate to default host for others
|
|
18
|
-
const compilerHost = {
|
|
19
|
-
...ts.createCompilerHost(parsedCommandLine.options),
|
|
20
|
-
getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
|
|
21
|
-
if (fileName === inMemoryFileName) {
|
|
22
|
-
return ts.createSourceFile(fileName, code, languageVersion, true);
|
|
23
|
-
}
|
|
24
|
-
return ts
|
|
25
|
-
.createCompilerHost(parsedCommandLine.options)
|
|
26
|
-
.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
|
|
27
|
-
},
|
|
28
|
-
fileExists: (fileName) => {
|
|
29
|
-
if (fileName === inMemoryFileName) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
return ts.sys.fileExists(fileName);
|
|
33
|
-
},
|
|
34
|
-
readFile: (fileName) => {
|
|
35
|
-
if (fileName === inMemoryFileName) {
|
|
36
|
-
return code;
|
|
37
|
-
}
|
|
38
|
-
return ts.sys.readFile(fileName);
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
// Create a program using the in-memory source file
|
|
42
|
-
const program = ts.createProgram({
|
|
43
|
-
rootNames: parsedCommandLine.fileNames.concat(inMemoryFileName),
|
|
44
|
-
options: parsedCommandLine.options,
|
|
45
|
-
host: compilerHost,
|
|
46
|
-
});
|
|
47
|
-
// Get all diagnostics for the program, which includes syntax and semantic errors
|
|
48
|
-
const diagnostics = ts.getPreEmitDiagnostics(program);
|
|
49
|
-
diagnostics.forEach((diagnostic) => {
|
|
50
|
-
if (diagnostic.file) {
|
|
51
|
-
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
52
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
53
|
-
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
return diagnostics;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=ts.js.map
|
package/dist/ts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ts.js","sourceRoot":"","sources":["../src/ts.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,IAAY;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9B,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,EAAE,CAAC,cAAc,CAClC,OAAO,EACP,EAAE,CAAC,GAAG,CAAC,UAAU,EACjB,eAAe,CAChB,CAAC;IACF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IACD,MAAM,UAAU,GAAG,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClE,MAAM,iBAAiB,GAAG,EAAE,CAAC,0BAA0B,CACrD,UAAU,CAAC,MAAM,EACjB,EAAE,CAAC,GAAG,EACN,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CACzB,CAAC;IAEF,wFAAwF;IACxF,MAAM,YAAY,GAAoB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AU,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,6BAA6B,CACvE,UAAU,CAAC,KAAM,CAClB,CAAC;YACF,MAAM,OAAO,GAAG,EAAE,CAAC,4BAA4B,CAC7C,UAAU,CAAC,WAAW,EACtB,IAAI,CACL,CAAC;YACF,OAAO,CAAC,GAAG,CACT,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,GAAG,CAAC,IAAI,SAAS,GAAG,CAAC,MAAM,OAAO,EAAE,CACzE,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CACT,EAAE,CAAC,4BAA4B,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,CAAC,CAC9D,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog-B53OMCvW.js","sources":["../src/lib/ui/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { cn } from \"../util/cn.js\";\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n \"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\",\n className,\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-1.5 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\n \"text-lg font-semibold leading-none tracking-tight\",\n className,\n )}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n"],"names":["Dialog","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","React","className","props","ref","jsx","cn","DialogContent","children","jsxs","X","DialogHeader","DialogFooter","DialogTitle","DialogDescription"],"mappings":";;;;;AAMA,MAAMA,IAASC,EAAgB,MAEzBC,IAAgBD,EAAgB,SAEhCE,IAAeF,EAAgB,QAE/BG,IAAcH,EAAgB,OAE9BI,IAAgBC,EAAM,WAG1B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAM,GAAGC,MAC1BC,gBAAAA,EAAA;AAAA,EAACT,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAQ;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IACF;AAAA,IACC,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAc,cAAcJ,EAAgB,QAAQ;AAEpD,MAAMW,IAAgBN,EAAM,WAG1B,CAAC,EAAE,WAAAC,GAAW,UAAAM,GAAU,GAAGL,EAAM,GAAGC,MACpCK,gBAAAA,EAAAA,KAACX,GACC,EAAA,UAAA;AAAA,EAAAO,gBAAAA,EAAA,IAACL,GAAc,EAAA;AAAA,EACfS,gBAAAA,EAAA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