Skip to content

Commit be32546

Browse files
authored
make paths resolvable to node (#335)
1 parent 24c841e commit be32546

28 files changed

+68
-80
lines changed

packages/components/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"@srcbook/shared": "workspace:^",
3535
"@uiw/codemirror-themes": "^4.23.2",
3636
"@uiw/react-codemirror": "^4.23.2",
37-
"@uiw/react-codemirror": "^4.23.2",
3837
"class-variance-authority": "^0.7.0",
3938
"cmdk": "^1.0.0",
4039
"marked": "catalog:",
@@ -50,8 +49,8 @@
5049
"codemirror": "*",
5150
"lucide-react": "*",
5251
"react": "*",
53-
"react-router-dom": "*",
5452
"react-hotkeys-hook": "*",
53+
"react-router-dom": "*",
5554
"react-textarea-autosize": "*",
5655
"sonner": "*",
5756
"tailwind-merge": "*",

packages/components/src/components/ai-generate-tips-dialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from 'react';
2-
import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle } from './ui/dialog';
2+
import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle } from './ui/dialog.js';
33

44
export default function AiGenerateTipsDialog({ children }: { children: React.ReactNode }) {
55
const [open, setOpen] = useState(false);

packages/components/src/components/cell-output.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { useState } from 'react';
22
import { Ban, Maximize, Minimize, PanelBottomClose, PanelBottomOpen, Sparkles } from 'lucide-react';
33
import { CodeCellType, PackageJsonCellType, TsServerDiagnosticType } from '@srcbook/shared';
4-
import { cn } from '../lib/utils';
5-
import { Tabs, TabsList, TabsTrigger, TabsContent } from './ui/underline-flat-tabs';
6-
import { useCells } from './use-cell';
4+
import { cn } from '../lib/utils.js';
5+
import { Tabs, TabsList, TabsTrigger, TabsContent } from './ui/underline-flat-tabs.js';
6+
import { useCells } from './use-cell.js';
77
import { OutputType, StdoutOutputType, StderrOutputType, CellModeType } from '../types';
8-
import { Button } from './ui/button';
8+
import { Button } from './ui/button.js';
99

1010
type Props = {
1111
cell: CodeCellType | PackageJsonCellType;

packages/components/src/components/cells/code.tsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* eslint-disable jsx-a11y/tabindex-no-positive -- this should be fixed and reworked or minimize excessive positibe tabindex */
22

33
import { useCallback, useEffect, useRef, useState } from 'react';
4-
import { Dialog, DialogContent } from '../ui/dialog';
5-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
6-
import Shortcut from '../keyboard-shortcut';
4+
import { Dialog, DialogContent } from '../ui/dialog.js';
5+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip.js';
6+
import Shortcut from '../keyboard-shortcut.js';
77
import { useNavigate } from 'react-router-dom';
88
import CodeMirror from '@uiw/react-codemirror';
99
import { javascript } from '@codemirror/lang-javascript';
10-
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '../ui/resizable';
10+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '../ui/resizable.js';
1111
import {
1212
Info,
1313
Play,
@@ -21,22 +21,22 @@ import {
2121
CopyIcon,
2222
} from 'lucide-react';
2323
import TextareaAutosize from 'react-textarea-autosize';
24-
import AiGenerateTipsDialog from '../ai-generate-tips-dialog';
24+
import AiGenerateTipsDialog from '../ai-generate-tips-dialog.js';
2525
import { CellType, CodeCellType, CodeCellUpdateAttrsType } from '@srcbook/shared';
26-
import { cn } from '../../lib/utils';
26+
import { cn } from '../../lib/utils.js';
2727
import { CellModeType, SessionType } from '../../types';
28-
import { Button } from '../ui/button';
29-
import { Input } from '../ui/input';
28+
import { Button } from '../ui/button.js';
29+
import { Input } from '../ui/input.js';
3030
import DeleteCellWithConfirmation from '../delete-cell-dialog';
31-
import { CellOutput } from '../cell-output';
32-
import useTheme from '../use-theme';
31+
import { CellOutput } from '../cell-output.js';
32+
import useTheme from '../use-theme.js';
3333
import { useDebouncedCallback } from 'use-debounce';
3434
import { EditorView } from 'codemirror';
3535
import { EditorState, Extension } from '@codemirror/state';
3636
import { unifiedMergeView } from '@codemirror/merge';
3737
import { toast } from 'sonner';
38-
import { PrettierLogo } from '../logos';
39-
import { useCells } from '../use-cell';
38+
import { PrettierLogo } from '../logos.js';
39+
import { useCells } from '../use-cell.js';
4040

4141
const DEBOUNCE_DELAY = 500;
4242

packages/components/src/components/cells/markdown.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import CodeMirror, { keymap, Prec, EditorView } from '@uiw/react-codemirror';
66
import { markdown } from '@codemirror/lang-markdown';
77
import { CircleAlert, Trash2, Pencil } from 'lucide-react';
88
import { CellType, MarkdownCellType, MarkdownCellUpdateAttrsType } from '@srcbook/shared';
9-
import { cn } from '../../lib/utils';
10-
import { Button } from '../ui/button';
11-
import DeleteCellWithConfirmation from '../delete-cell-dialog';
12-
import useTheme from '../use-theme';
9+
import { cn } from '../../lib/utils.js';
10+
import { Button } from '../ui/button.js';
11+
import DeleteCellWithConfirmation from '../delete-cell-dialog.js';
12+
import useTheme from '../use-theme.js';
1313

1414
marked.use({ gfm: true });
1515

packages/components/src/components/cells/title.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TitleCellType, TitleCellUpdateAttrsType } from '@srcbook/shared';
2-
import { EditableH1 } from '../ui/heading';
2+
import { EditableH1 } from '../ui/heading.js';
33

44
type BaseProps = {
55
cell: TitleCellType;

packages/components/src/components/delete-cell-dialog.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { useState } from 'react';
2-
import { Button } from './ui/button';
2+
import { Button } from './ui/button.js';
33
import {
44
Dialog,
55
DialogTrigger,
66
DialogContent,
77
DialogHeader,
88
DialogTitle,
99
DialogDescription,
10-
} from './ui/dialog';
10+
} from './ui/dialog.js';
1111

1212
export default function DeleteCellWithConfirmationModal({
1313
onDeleteCell,

packages/components/src/components/ui/button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import { Slot } from '@radix-ui/react-slot';
33
import { cva, type VariantProps } from 'class-variance-authority';
44

5-
import { cn } from '../../lib/utils';
5+
import { cn } from '../../lib/utils.js';
66

77
const buttonVariants = cva(
88
'inline-flex items-center justify-center whitespace-nowrap rounded-sm text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 active:translate-y-0.5',

packages/components/src/components/ui/card.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
import { cn } from '../../lib/utils';
3+
import { cn } from '../../lib/utils.js';
44

55
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
66
({ className, ...props }, ref) => (

packages/components/src/components/ui/command.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { type DialogProps } from '@radix-ui/react-dialog';
33
import { MagnifyingGlassIcon } from '@radix-ui/react-icons';
44
import { Command as CommandPrimitive } from 'cmdk';
55

6-
import { cn } from '../../lib/utils';
7-
import { Dialog, DialogContent } from './dialog';
6+
import { cn } from '../../lib/utils.js';
7+
import { Dialog, DialogContent } from './dialog.js';
88

99
const Command = React.forwardRef<
1010
React.ElementRef<typeof CommandPrimitive>,

packages/components/src/components/ui/dialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import * as DialogPrimitive from '@radix-ui/react-dialog';
33
import { Cross2Icon } from '@radix-ui/react-icons';
44

5-
import { cn } from '../../lib/utils';
5+
import { cn } from '../../lib/utils.js';
66

77
const Dialog = DialogPrimitive.Root;
88

packages/components/src/components/ui/dropdown-menu.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as React from 'react';
44
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
55
import { Check, ChevronRight, Circle } from 'lucide-react';
66

7-
import { cn } from '../../lib/utils';
7+
import { cn } from '../../lib/utils.js';
88

99
const DropdownMenu = DropdownMenuPrimitive.Root;
1010

packages/components/src/components/ui/heading.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useRef, useState } from 'react';
22

3-
import { cn } from '../../lib/utils';
3+
import { cn } from '../../lib/utils.js';
44
import { TitleCellUpdateAttrsSchema } from '@srcbook/shared';
55

66
const className =

packages/components/src/components/ui/input.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
import { cn } from '../../lib/utils';
3+
import { cn } from '../../lib/utils.js';
44

55
const Input = React.forwardRef<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>(
66
({ className, type, ...props }, ref) => {

packages/components/src/components/ui/navigation-menu.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
33
import { cva } from 'class-variance-authority';
44

5-
import { cn } from '../../lib/utils';
5+
import { cn } from '../../lib/utils.js';
66

77
const NavigationMenu = React.forwardRef<
88
React.ElementRef<typeof NavigationMenuPrimitive.Root>,

packages/components/src/components/ui/popover.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import * as PopoverPrimitive from '@radix-ui/react-popover';
33

4-
import { cn } from '../../lib/utils';
4+
import { cn } from '../../lib/utils.js';
55

66
const Popover = PopoverPrimitive.Root;
77

packages/components/src/components/ui/resizable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { DragHandleDots2Icon } from '@radix-ui/react-icons';
22
import * as ResizablePrimitive from 'react-resizable-panels';
33

4-
import { cn } from '../../lib/utils';
4+
import { cn } from '../../lib/utils.js';
55

66
const ResizablePanelGroup = ({
77
className,

packages/components/src/components/ui/select.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import { CaretSortIcon, CheckIcon, ChevronDownIcon, ChevronUpIcon } from '@radix-ui/react-icons';
33
import * as SelectPrimitive from '@radix-ui/react-select';
44

5-
import { cn } from '../../lib/utils';
5+
import { cn } from '../../lib/utils.js';
66

77
const Select = SelectPrimitive.Root;
88

packages/components/src/components/ui/sheet.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as SheetPrimitive from '@radix-ui/react-dialog';
33
import { Cross2Icon } from '@radix-ui/react-icons';
44
import { cva, type VariantProps } from 'class-variance-authority';
55

6-
import { cn } from '../../lib/utils';
6+
import { cn } from '../../lib/utils.js';
77

88
const Sheet = SheetPrimitive.Root;
99

packages/components/src/components/ui/switch.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import * as SwitchPrimitives from '@radix-ui/react-switch';
33

4-
import { cn } from '../../lib/utils';
4+
import { cn } from '../../lib/utils.js';
55

66
const Switch = React.forwardRef<
77
React.ElementRef<typeof SwitchPrimitives.Root>,

packages/components/src/components/ui/tabs.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import * as TabsPrimitive from '@radix-ui/react-tabs';
33

4-
import { cn } from '../../lib/utils';
4+
import { cn } from '../../lib/utils.js';
55

66
const Tabs = TabsPrimitive.Root;
77

packages/components/src/components/ui/textarea.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
import { cn } from '../../lib/utils';
3+
import { cn } from '../../lib/utils.js';
44

55
const Textarea = React.forwardRef<
66
HTMLTextAreaElement,

packages/components/src/components/ui/tooltip.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
33

4-
import { cn } from '../../lib/utils';
4+
import { cn } from '../../lib/utils.js';
55

66
const TooltipProvider = TooltipPrimitive.Provider;
77

packages/components/src/components/ui/underline-flat-tabs.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import * as TabsPrimitive from '@radix-ui/react-tabs';
33

4-
import { cn } from '../../lib/utils';
4+
import { cn } from '../../lib/utils.js';
55

66
const Tabs = TabsPrimitive.Root;
77

packages/components/src/components/use-theme.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from 'react';
2-
import { srcbookLight, srcbookDark } from '..//lib/code-theme';
2+
import { srcbookLight, srcbookDark } from '../lib/code-theme.js';
33

44
export type ThemeType = 'light' | 'dark';
55
export type CodeThemeType = typeof srcbookLight | typeof srcbookDark;

packages/components/src/index.tsx

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
import TitleCell from './components/cells/title';
2-
import MarkdownCell from './components/cells/markdown';
3-
import CodeCell from './components/cells/code';
1+
import TitleCell from './components/cells/title.js';
2+
import MarkdownCell from './components/cells/markdown.js';
3+
import CodeCell from './components/cells/code.js';
44
export { TitleCell, MarkdownCell, CodeCell };
55

6-
export * from './components/ui/button';
7-
export * from './components/ui/card';
8-
export * from './components/ui/collapsible';
9-
export * from './components/ui/command';
10-
export * from './components/ui/dialog';
6+
export * from './components/ui/button.js';
7+
export * from './components/ui/card.js';
8+
export * from './components/ui/collapsible.js';
9+
export * from './components/ui/command.js';
10+
export * from './components/ui/dialog.js';
1111
export * from './components/ui/dropdown-menu';
12-
export * from './components/ui/heading';
13-
export * from './components/ui/input';
14-
export * from './components/ui/navigation-menu';
15-
export * from './components/ui/popover';
16-
export * from './components/ui/resizable';
17-
export * from './components/ui/select';
18-
export * from './components/ui/sheet';
19-
export * from './components/ui/sonner';
20-
export * from './components/ui/switch';
21-
export * from './components/ui/tabs';
22-
export * from './components/ui/textarea';
23-
export * from './components/ui/tooltip';
12+
export * from './components/ui/heading.js';
13+
export * from './components/ui/input.js';
14+
export * from './components/ui/navigation-menu.js';
15+
export * from './components/ui/popover.js';
16+
export * from './components/ui/resizable.js';
17+
export * from './components/ui/select.js';
18+
export * from './components/ui/sheet.js';
19+
export * from './components/ui/sonner.js';
20+
export * from './components/ui/switch.js';
21+
export * from './components/ui/tabs.js';
22+
export * from './components/ui/textarea.js';
23+
export * from './components/ui/tooltip.js';
2424
export {
2525
Tabs as UnderlineTabs,
2626
TabsList as UnderlingTabsList,
2727
TabsTrigger as UnderlineTabsTrigger,
2828
TabsContent as UnderlineTabsContent,
29-
} from './components/ui/underline-flat-tabs';
29+
} from './components/ui/underline-flat-tabs.js';
3030

31-
export * from './lib/utils';
31+
export * from './lib/utils.js';

packages/components/src/ui/heading.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useRef, useState } from 'react';
22

3-
import { cn } from '../lib/utils';
3+
import { cn } from '../lib/utils.js';
44
import { TitleCellUpdateAttrsSchema } from '@srcbook/shared';
55

66
const className =

pnpm-lock.yaml

+1-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)