Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export default [

globals: {
// Browser globals
SVGGElement: 'readonly',
SVGElement: 'readonly',
DOMException: 'readonly',
requestIdleCallback: 'readonly',
cancelIdleCallback: 'readonly',
Expand Down
34 changes: 17 additions & 17 deletions packages/docs/audits/project-archiving-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -949,23 +949,23 @@ describe('Subscription Downgrade Flow', () => {

## File Change Summary

| File | Change Type | Description |
| -------------------------------------------------------------- | ----------- | ------------------------------------------------------- |
| `packages/workers/src/db/schema.ts` | Modify | Add `isArchived`, `archivedAt`, `archivedBy` columns |
| `packages/workers/src/middleware/requireActiveProject.ts` | New | Middleware to block mutations on archived projects |
| `packages/workers/src/middleware/requireOrg.ts` | Modify | Include `isArchived` in project select |
| `packages/workers/src/routes/orgs/projects.ts` | Modify | Add archive/unarchive endpoints, apply middleware |
| `packages/workers/src/routes/billing/subscription.ts` | Modify | Extend response with `quotas` and `requiresArchiving` |
| `packages/workers/src/durable-objects/ProjectDoc.ts` | Modify | Track archived status, block updates |
| `packages/web/src/stores/projectStore.js` | Modify | Add `isProjectArchived` helper |
| `packages/web/src/components/project/ProjectContext.jsx` | Modify | Add `isArchived` to context |
| `packages/web/src/components/project/ArchivedBanner.jsx` | New | Banner component for archived projects |
| `packages/web/src/components/project/ProjectView.jsx` | Modify | Include ArchivedBanner |
| `packages/web/src/components/project/ProjectHeader.jsx` | Modify | Check archived in canEdit |
| `packages/web/src/components/project/ProjectCard.jsx` | Modify | Show archived badge |
| `packages/web/src/components/billing/ArchiveProjectsModal.jsx` | New | Modal for selecting projects to archive |
| `packages/web/src/primitives/useProject/index.js` | Modify | Handle archived status, disable mutations |
| `packages/web/src/components/layout/AppLayout.jsx` | Modify | Add quota check using existing subscription query |
| File | Change Type | Description |
| -------------------------------------------------------------- | ----------- | ----------------------------------------------------- |
| `packages/workers/src/db/schema.ts` | Modify | Add `isArchived`, `archivedAt`, `archivedBy` columns |
| `packages/workers/src/middleware/requireActiveProject.ts` | New | Middleware to block mutations on archived projects |
| `packages/workers/src/middleware/requireOrg.ts` | Modify | Include `isArchived` in project select |
| `packages/workers/src/routes/orgs/projects.ts` | Modify | Add archive/unarchive endpoints, apply middleware |
| `packages/workers/src/routes/billing/subscription.ts` | Modify | Extend response with `quotas` and `requiresArchiving` |
| `packages/workers/src/durable-objects/ProjectDoc.ts` | Modify | Track archived status, block updates |
| `packages/web/src/stores/projectStore.js` | Modify | Add `isProjectArchived` helper |
| `packages/web/src/components/project/ProjectContext.jsx` | Modify | Add `isArchived` to context |
| `packages/web/src/components/project/ArchivedBanner.jsx` | New | Banner component for archived projects |
| `packages/web/src/components/project/ProjectView.jsx` | Modify | Include ArchivedBanner |
| `packages/web/src/components/project/ProjectHeader.jsx` | Modify | Check archived in canEdit |
| `packages/web/src/components/project/ProjectCard.jsx` | Modify | Show archived badge |
| `packages/web/src/components/billing/ArchiveProjectsModal.jsx` | New | Modal for selecting projects to archive |
| `packages/web/src/primitives/useProject/index.js` | Modify | Handle archived status, disable mutations |
| `packages/web/src/components/layout/AppLayout.jsx` | Modify | Add quota check using existing subscription query |

---

Expand Down
22 changes: 0 additions & 22 deletions packages/web/src/components/Dashboard.jsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/web/src/components/mocks/MockIndex.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default function MockIndex() {

{/* Other Mocks */}
<div>
<h2 class='mb-3 text-lg font-semibold text-gray-700'>Other Mocks</h2>
<h2 class='mb-3 text-lg font-semibold text-gray-700'>Components</h2>
<div class='grid gap-4'></div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import {
useAnnotationCapability,
type AnnotationSelectionMenuProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { AnnotationTool, useAnnotationCapability } from '@embedpdf/plugin-annotation/react';
import { useHistoryCapability } from '@embedpdf/plugin-history/react';
import { useEffect, useState, useMemo } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useEffect, useRef, useState } from 'react';
import { useCapture } from '@embedpdf/plugin-capture/react';
import { Dialog, DialogContent, DialogFooter, Button } from './ui';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useCommand } from '@embedpdf/plugin-commands/react';
import { useRegisterAnchor } from '@embedpdf/plugin-ui/react';
import { twMerge } from 'tailwind-merge';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useState } from 'react';
import { useExport } from '@embedpdf/plugin-export/react';
import { useCapture } from '@embedpdf/plugin-capture/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useState } from 'react';
import { useDocumentManagerCapability } from '@embedpdf/plugin-document-manager/react';
import { PdfErrorCode } from '@embedpdf/models';
Expand Down Expand Up @@ -89,7 +90,7 @@ export function DocumentPasswordPrompt({ documentState }: DocumentPasswordPrompt
<input
type='password'
value={password}
onChange={e => setPassword(e.target.value)}
onChange={e => setPassword((e.target as HTMLInputElement).value)}
onKeyDown={e => e.key === 'Enter' && !isRetrying && password.trim() && handleRetry()}
disabled={isRetrying}
placeholder='Enter document password'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useDocumentManagerCapability } from '@embedpdf/plugin-document-manager/react';

interface EmptyStateProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { CSSProperties } from 'preact';

type IconProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
type LoadingSpinnerProps = {
size?: 'sm' | 'md' | 'lg';
message?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useViewportCapability } from '@embedpdf/plugin-viewport/react';
import { useScroll } from '@embedpdf/plugin-scroll/react';
import { useEffect, useRef, useState, useCallback } from 'react';
Expand All @@ -15,7 +16,7 @@ export function PageControls({ documentId }: PageControlsProps) {
} = useScroll(documentId);
const [isVisible, setIsVisible] = useState(false);
const [isHovering, setIsHovering] = useState(false);
const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const hideTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const [inputValue, setInputValue] = useState<string>(currentPage.toString());

useEffect(() => {
Expand Down Expand Up @@ -117,7 +118,7 @@ export function PageControls({ documentId }: PageControlsProps) {
name='page'
value={inputValue}
onChange={e => {
const value = e.target.value.replace(/[^0-9]/g, '');
const value = (e.target as HTMLInputElement).value.replace(/[^0-9]/g, '');
setInputValue(value);
}}
className='h-7 w-10 rounded border border-gray-300 bg-white px-1 text-center text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useState } from 'preact/hooks';
import { useRotate } from '@embedpdf/plugin-rotate/react';
import { useSpread } from '@embedpdf/plugin-spread/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { usePan } from '@embedpdf/plugin-pan/react';
import { HandIcon } from './icons';
import { ToolbarButton } from './ui';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useState, useMemo } from 'preact/hooks';
import { ToolbarButton, DropdownMenu, DropdownItem } from './ui';
import { DocumentIcon } from './icons';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useState, useEffect } from 'preact/hooks';
import { usePrint } from '@embedpdf/plugin-print/react';
import { useScroll } from '@embedpdf/plugin-scroll/react';
Expand Down Expand Up @@ -86,7 +87,7 @@ export function PrintDialog({ documentId, isOpen, onClose }: PrintDialogProps) {
name='selection'
value='all'
checked={selection === 'all'}
onChange={e => setSelection(e.target.value as PageSelection)}
onChange={e => setSelection((e.target as HTMLInputElement).value as PageSelection)}
className='h-4 w-4 border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500'
/>
<span className='ml-2 text-sm text-gray-700'>All pages</span>
Expand All @@ -98,7 +99,7 @@ export function PrintDialog({ documentId, isOpen, onClose }: PrintDialogProps) {
name='selection'
value='current'
checked={selection === 'current'}
onChange={e => setSelection(e.target.value as PageSelection)}
onChange={e => setSelection((e.target as HTMLInputElement).value as PageSelection)}
className='h-4 w-4 border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500'
/>
<span className='ml-2 text-sm text-gray-700'>
Expand All @@ -112,7 +113,7 @@ export function PrintDialog({ documentId, isOpen, onClose }: PrintDialogProps) {
name='selection'
value='custom'
checked={selection === 'custom'}
onChange={e => setSelection(e.target.value as PageSelection)}
onChange={e => setSelection((e.target as HTMLInputElement).value as PageSelection)}
className='h-4 w-4 border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500'
/>
<span className='ml-2 text-sm text-gray-700'>Specify pages</span>
Expand All @@ -124,7 +125,7 @@ export function PrintDialog({ documentId, isOpen, onClose }: PrintDialogProps) {
<input
type='text'
value={customPages}
onChange={e => setCustomPages(e.target.value)}
onChange={e => setCustomPages((e.target as HTMLInputElement).value)}
placeholder='e.g., 1-3, 5, 8-10'
disabled={selection !== 'custom'}
className='w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none disabled:bg-gray-50 disabled:text-gray-500'
Expand All @@ -143,7 +144,7 @@ export function PrintDialog({ documentId, isOpen, onClose }: PrintDialogProps) {
<input
type='checkbox'
checked={includeAnnotations}
onChange={e => setIncludeAnnotations(e.target.checked)}
onChange={e => setIncludeAnnotations((e.target as HTMLInputElement).checked)}
className='h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500'
/>
<span className='ml-2 text-sm text-gray-700'>Include annotations</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import {
useRedactionCapability,
type RedactionSelectionMenuProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { RedactionMode, useRedaction } from '@embedpdf/plugin-redaction/react';
import { ToolbarButton } from './ui';
import { CheckIcon, CloseIcon, RedactTextIcon, RedactAreaIcon } from './icons';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useSearch } from '@embedpdf/plugin-search/react';
import { useScrollCapability } from '@embedpdf/plugin-scroll/react';
import { useState, useRef, useEffect } from 'preact/hooks';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { SelectionSelectionMenuProps } from '@embedpdf/plugin-selection/react';
import { useSelectionCapability } from '@embedpdf/plugin-selection/react';
import { useState, useEffect } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useEffect, useRef } from 'preact/hooks';
import { DocumentState } from '@embedpdf/core';
import { useViewManagerCapability, useAllViews } from '@embedpdf/plugin-view-manager/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { ThumbnailsPane, ThumbImg } from '@embedpdf/plugin-thumbnail/react';
import { useScroll } from '@embedpdf/plugin-scroll/react';

Expand All @@ -6,7 +7,7 @@ type ThumbnailsSidebarProps = {
onClose?: () => void;
};

export function ThumbnailsSidebar({ documentId, _onClose }: ThumbnailsSidebarProps) {
export function ThumbnailsSidebar({ documentId, onClose: _onClose }: ThumbnailsSidebarProps) {
const { state, provides } = useScroll(documentId);

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { ButtonHTMLAttributes, ReactNode } from 'react';

type ButtonVariant = 'default' | 'primary' | 'secondary' | 'ghost';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { ReactNode } from 'react';

type DialogContentProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { ReactNode } from 'react';

type DialogFooterProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { ReactNode, useEffect, useRef } from 'react';
import { CloseIcon } from '../icons';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { ReactNode } from 'react';

type DropdownMenuProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { ReactNode, forwardRef } from 'react';
import { twMerge } from 'tailwind-merge';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
type ToolbarDividerProps = {
orientation?: 'vertical' | 'horizontal';
className?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { ZoomToolbar } from './zoom-toolbar';
import { PanToggleButton } from './pan-toggle';
import { PageSettingsMenu } from './page-settings-menu';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useZoom } from '@embedpdf/plugin-zoom/react';
import { ZoomMode } from '@embedpdf/plugin-zoom';
import { useState } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { useMemo, useRef, useState, useEffect } from 'preact/hooks';
import { EmbedPDF } from '@embedpdf/core/react';
import { usePdfiumEngine } from '@embedpdf/engines/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"baseUrl": "../../../../..",
"paths": {
"react": ["node_modules/preact/compat"],
"react-dom": ["node_modules/preact/compat"],
"react/jsx-runtime": ["node_modules/preact/jsx-runtime"]
}
Comment on lines +22 to +28
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Check repository structure and locate the tsconfig file
git ls-files | grep -E "(packages/web/src/components/pdf|tsconfig)" | head -20

Repository: InfinityBowman/corates

Length of output: 1472


🏁 Script executed:

# Verify the actual tsconfig.json file exists and read its full content
if [ -f "packages/web/src/components/pdf/embedpdf/preact/tsconfig.json" ]; then
  echo "=== File exists, reading content ==="
  cat -n "packages/web/src/components/pdf/embedpdf/preact/tsconfig.json"
else
  echo "File not found at expected location"
  # Try to find it
  find . -name "tsconfig.json" -path "*embedpdf*preact*" 2>/dev/null
fi

Repository: InfinityBowman/corates

Length of output: 1217


🏁 Script executed:

# Check directory structure to verify baseUrl path calculation
# From packages/web/src/components/pdf/embedpdf/preact/, ../../../../.. should resolve to:
python3 << 'EOF'
from pathlib import Path
import os

# Starting point
tsconfig_dir = Path("packages/web/src/components/pdf/embedpdf/preact")
print(f"tsconfig location: {tsconfig_dir}")
print(f"Depth from root: {len(tsconfig_dir.parts)}")

# Apply baseUrl ../../../../..
resolved = tsconfig_dir
for _ in range(5):
    resolved = resolved.parent
    
print(f"baseUrl '../../../../..' resolves to: {resolved}")
print(f"Path relative to repo root: {resolved.relative_to('.')}")

# Check where node_modules typically are
print(f"\nCommon node_modules locations:")
for potential_nm in ["node_modules", "packages/web/node_modules", "packages/node_modules"]:
    if Path(potential_nm).exists():
        print(f"  ✓ {potential_nm} exists")
    else:
        print(f"  ✗ {potential_nm} does not exist")
EOF

Repository: InfinityBowman/corates

Length of output: 152


🏁 Script executed:

# Check if the referenced preact packages exist in node_modules
echo "=== Checking preact references ==="
if [ -d "node_modules" ]; then
  echo "node_modules at repo root:"
  ls -la node_modules | grep preact
elif [ -d "packages/web/node_modules" ]; then
  echo "node_modules at packages/web:"
  ls -la packages/web/node_modules | grep preact
else
  echo "Checking for preact in package.json files:"
  rg "preact" packages/web/package.json --context 2
fi

Repository: InfinityBowman/corates

Length of output: 127


🏁 Script executed:

# Check the actual workspace structure and whether path mapping would work
echo "=== Package structure ==="
ls -la packages/web/src/components/pdf/embedpdf/ 2>/dev/null || echo "Directory structure not found"
echo ""
echo "=== Parent tsconfig.json files if any ==="
find packages/web/src/components/pdf -name "tsconfig.json" 2>/dev/null

Repository: InfinityBowman/corates

Length of output: 431


🏁 Script executed:

# Check where preact is actually installed in the monorepo
echo "=== Checking package.json for preact dependencies ==="
rg "preact" packages/web/package.json -A 2 -B 2

echo -e "\n=== Checking root package.json ==="
if [ -f "package.json" ]; then
  rg "preact" package.json -A 2 -B 2
fi

echo -e "\n=== Verify correct baseUrl depth from tsconfig location ==="
python3 << 'EOF'
from pathlib import Path

tsconfig_path = Path("packages/web/src/components/pdf/embedpdf/preact")
print(f"tsconfig directory: {tsconfig_path}")
print(f"Parts: {list(tsconfig_path.parts)}")
print(f"Depth: {len(tsconfig_path.parts)} levels from root")

# To reach repo root
levels_to_root = len(tsconfig_path.parts)
print(f"\nTo reach repo root from tsconfig location:")
print(f"  Need to go up {levels_to_root} levels")
print(f"  baseUrl should be: {''.join(['../' for _ in range(levels_to_root)])}")

# Current baseUrl analysis
current_baseurl = "../../../../.."
levels_up = current_baseurl.count("..")
resolved_from = Path("packages/web/src/components/pdf/embedpdf/preact")
for _ in range(levels_up):
    resolved_from = resolved_from.parent
print(f"\nCurrent baseUrl '{current_baseurl}':")
print(f"  Goes up {levels_up} levels")
print(f"  Resolves to: {resolved_from}")
EOF

Repository: InfinityBowman/corates

Length of output: 152


🏁 Script executed:

# Verify node_modules structure
echo "=== Monorepo node_modules structure ==="
if [ -d "node_modules/preact" ]; then
  echo "✓ Found preact at repo root node_modules"
  ls -la node_modules/preact | head -10
elif [ -d "packages/web/node_modules/preact" ]; then
  echo "✓ Found preact at packages/web/node_modules"
else
  echo "Checking installed packages:"
  find . -type d -name "preact" -not -path "*/src/*" 2>/dev/null | head -5
fi

Repository: InfinityBowman/corates

Length of output: 134


🏁 Script executed:

# Try simple cat to read package.json instead of rg (which timed out)
echo "=== packages/web/package.json dependencies ==="
if [ -f "packages/web/package.json" ]; then
  cat packages/web/package.json | grep -A 5 -B 5 "preact" || echo "No preact found in packages/web/package.json"
fi

echo -e "\n=== root package.json dependencies ==="
if [ -f "package.json" ]; then
  cat package.json | grep -A 5 -B 5 "preact" || echo "No preact found in root package.json"
fi

Repository: InfinityBowman/corates

Length of output: 812


🏁 Script executed:

# Check the actual depth calculation and verify if node_modules is accessible
python3 << 'EOF'
from pathlib import Path
import os

print("=== Path Resolution Analysis ===\n")

# Calculate where baseUrl points
tsconfig_dir = Path("packages/web/src/components/pdf/embedpdf/preact")
print(f"tsconfig.json is at: {tsconfig_dir}")
print(f"Relative path parts from root: {len(tsconfig_dir.parts)}")

# Current baseUrl
current_base = "../../../../.."
levels = current_base.count("..")
resolved = tsconfig_dir
for i in range(levels):
    resolved = resolved.parent
    
print(f"\nbaseUrl '{current_base}' (5 levels up) resolves to:")
print(f"  {resolved} (relative path: {resolved.relative_to('.') if resolved.relative_to('.') != Path('.') else 'repo root'})")

# Paths mapping
print(f"\nPath mappings would resolve to:")
print(f"  'react' → {resolved}/node_modules/preact/compat")
print(f"  'react-dom' → {resolved}/node_modules/preact/compat")
print(f"  'react/jsx-runtime' → {resolved}/node_modules/preact/jsx-runtime")

# Check if these paths exist
print(f"\nVerifying if resolved paths exist:")
for subpath in ["node_modules/preact/compat", "node_modules/preact/jsx-runtime"]:
    full_path = resolved / subpath
    exists = "✓" if full_path.exists() else "✗"
    print(f"  {exists} {full_path}")
EOF

Repository: InfinityBowman/corates

Length of output: 638


🏁 Script executed:

# Check if this is a monorepo with workspaces
echo "=== Checking monorepo configuration ==="
if [ -f "pnpm-workspace.yaml" ]; then
  echo "pnpm workspaces:"
  cat pnpm-workspace.yaml
elif [ -f "turbo.json" ]; then
  echo "Turbo config:"
  head -20 turbo.json
else
  echo "Checking package.json for workspaces:"
  cat package.json | grep -A 10 '"workspaces"' || echo "No workspace config found in root package.json"
fi

Repository: InfinityBowman/corates

Length of output: 293


🏁 Script executed:

# Direct check: does preact exist in packages/web/node_modules?
ls -la packages/web/node_modules 2>/dev/null | grep -i preact || echo "No preact in packages/web/node_modules"

Repository: InfinityBowman/corates

Length of output: 104


🏁 Script executed:

# Check if preact is at the repo root node_modules (as expected in pnpm monorepo)
echo "=== Checking root node_modules for preact ==="
if [ -d "node_modules/preact" ]; then
  echo "✓ Found preact at repo root node_modules"
  echo ""
  echo "Package structure:"
  ls -la node_modules/preact/compat 2>/dev/null || echo "  preact/compat directory exists: $([ -d 'node_modules/preact/compat' ] && echo 'YES' || echo 'NO')"
  ls -la node_modules/preact/jsx-runtime 2>/dev/null || echo "  preact/jsx-runtime directory exists: $([ -d 'node_modules/preact/jsx-runtime' ] && echo 'YES' || echo 'NO')"
else
  echo "✗ preact NOT found at repo root node_modules"
  echo ""
  echo "Checking node_modules directory:"
  ls -d node_modules 2>/dev/null && echo "node_modules exists at root" || echo "node_modules does not exist at root"
fi

Repository: InfinityBowman/corates

Length of output: 231


🏁 Script executed:

# Verify the correct baseUrl depth needed for pnpm root node_modules
python3 << 'EOF'
from pathlib import Path

tsconfig_dir = Path("packages/web/src/components/pdf/embedpdf/preact")
repo_root = Path(".")

# Calculate correct levels to reach repo root
current = tsconfig_dir
levels_needed = 0
while current != repo_root:
    current = current.parent
    levels_needed += 1

print(f"Correct baseUrl depth to reach repo root:")
print(f"  Need to go up {levels_needed} levels")
print(f"  Correct baseUrl should be: {''.join(['../' for _ in range(levels_needed)])}")

print(f"\nCurrent baseUrl analysis:")
current_base = "../../../../.."
current_levels = current_base.count("..")
print(f"  Current: '{current_base}' ({current_levels} levels)")
print(f"  ERROR: Currently goes up {current_levels} levels, but should go up {levels_needed}")
print(f"  Missing {levels_needed - current_levels} level(s)")

print(f"\nWith correct baseUrl, paths would resolve to:")
print(f"  'react' → node_modules/preact/compat")
print(f"  'react-dom' → node_modules/preact/compat")
print(f"  'react/jsx-runtime' → node_modules/preact/jsx-runtime")
EOF

Repository: InfinityBowman/corates

Length of output: 511


Fix baseUrl depth: should be 7 levels, not 5, to reach repo root node_modules.

The baseUrl: "../../../../.." (5 levels) resolves to packages/web/, but preact packages are hoisted at the repo root node_modules in this pnpm monorepo. The paths then incorrectly point to nonexistent packages/web/node_modules/preact/compat and packages/web/node_modules/preact/jsx-runtime.

Change baseUrl to "..../../../../../../" (7 levels) so paths resolve to the correct node_modules/preact/compat and node_modules/preact/jsx-runtime at repo root.

🤖 Prompt for AI Agents
In `@packages/web/src/components/pdf/embedpdf/preact/tsconfig.json` around lines
22 - 28, Update tsconfig.json so baseUrl points seven levels up instead of five:
change the "baseUrl" value (currently "../../../../..") to use seven "../"
segments (i.e., "../" repeated 7) so the "paths" entries for "react",
"react-dom", and "react/jsx-runtime" resolve to the monorepo root
node_modules/preact packages.

},
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
"types": ["vite/client"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"],
"exclude": ["node_modules", "dist", "**/preact/**", "**/preact-2/**"]
"exclude": ["node_modules", "dist", "src/components/pdf/embedpdf/preact"]
}