Skip to content

Conversation

@Kitenite
Copy link
Contributor

@Kitenite Kitenite commented Sep 24, 2025

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Release
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes


Important

Update import statements to use inline type imports across the codebase, enhancing consistency and aligning with TypeScript best practices.

  • Imports:
    • Update import statements to use inline type imports across various files, including index.tsx, font-config-manager.ts, and font-upload-manager.ts.
    • Affects files in packages/fonts/src/helpers, packages/parser/src, and tooling/eslint/base.js.
  • ESLint Configuration:
    • Modify ESLint rules in base.js to enforce inline type imports using import/consistent-type-specifier-style rule.
  • Miscellaneous:
    • Minor code formatting and consistency improvements in affected files.

This description was created by Ellipsis for 5633366. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when importing projects, including more robust Next.js detection (App vs Pages), stricter port validation, safer file uploads, and clearer, consistent error messages.
  • Refactor
    • Broad internal cleanup separating type and runtime imports across editor, fonts, parser, and growth modules for better maintainability without changing behavior.
  • Chores
    • Updated linting rules to prefer inline type specifiers and reduced rule severity, smoothing developer workflow while keeping code quality high.

@supabase
Copy link

supabase bot commented Sep 24, 2025

This pull request has been ignored for the connected project wowaemfasoptxrdjhilu because there are no changes detected in apps/backend/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai
Copy link

coderabbitai bot commented Sep 24, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Broad refactor separates type-only and runtime imports across many modules, renames parser exports (t/T) in packages.ts, and updates dependent imports. A Next.js project import context gains stricter validation, expanded Project shape, additional state fields, and refined finalize/upload flow. Minor signature tweaks remove explicit types from defaulted params. ESLint rule adjusted.

Changes

Cohort / File(s) Summary
Project Import Context
apps/web/client/src/app/projects/import/local/_context/index.tsx
Expanded Project interface (adds folderPath, files). Tightened validation and router detection for Next.js projects. Added new provider state fields (direction, isFinalizing, error). Safer optional chaining and type checks. Adjusted finalize and upload flow; stricter detectPortFromPackageJson guard.
Font Editor Managers
apps/web/client/src/components/store/editor/font/font-config-manager.ts, .../font-upload-manager.ts, .../layout-manager.ts
Reorganized imports to separate type-only and value imports; minor formatting; added explicit assertions where needed. No behavior changes.
Editor Utilities
apps/web/client/src/components/store/editor/pages/helper.ts, .../theme/util.ts
Consolidated/import-split for parser and other deps; nanoid import normalized; added type-only imports. No logic changes.
Fonts Helpers
packages/fonts/src/helpers/ast-generators.ts, .../ast-manipulators.ts, .../class-utils.ts, .../font-extractors.ts, .../import-export-manager.ts, .../validators.ts, packages/fonts/src/utils.ts
Split type/value imports from @onlook/parser and @onlook/models; minor internal safety tweaks (optional chaining, regex exec). No public API changes.
Fonts Tests
packages/fonts/test/*.test.ts
Updated imports to new parser export shape (t/T). No test logic changes.
Parser: code-edit modules
packages/parser/src/code-edit/{group,helpers,image,insert,layout,move,next-config,remove,style,text,transform}.ts
Consistent separation of type-only and value imports; minor guard changes (optional chaining), trivial formatting. No functional changes except import surface updates.
Parser: core exports and helpers
packages/parser/src/packages.ts, .../helpers.ts, .../ids.ts, .../parse.ts, .../template-node/{helpers,map}.ts
Public export rename: typest; type ttype T. Downstream imports updated. Removed explicit types on defaulted params in multiple functions. No control-flow changes.
Growth package
packages/growth/src/{inject,remove}.ts
Import refactors to new parser export shape; trivial loop formatting edit. No behavior change.
ESLint config
tooling/eslint/base.js
Adds node:path import. Changes import/consistent-type-specifier-style rule to warn with prefer-inline.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as Import UI
  participant Ctx as ProjectCreationContext
  participant FS as Code Provider
  participant NX as Next.js Detector

  User->>UI: Select local project
  UI->>Ctx: initialize(projectPath, files)
  Ctx->>NX: validateNextJsProject(package.json, files)
  NX-->>Ctx: {routerType, deps, layoutInfo}
  Ctx->>Ctx: setState({direction, isFinalizing=false})
  Ctx->>FS: writeFile(uploaded layout/scripts)
  FS-->>Ctx: ack
  Ctx->>Ctx: finalizeProject()
  Ctx-->>UI: done or error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

  • feat: add branching #2763 — Touches the same import context file and adjusts project/provider types; overlaps in Project creation and session inputs.

Poem

In fields of types I softly tread,
I split the t from T instead.
With whiskers twitching, routes I check,
Projects finalize—no promise wreck.
A gentle lint, a softer rule,
Hop-hop, the parser’s calm and cool.
Carrot commits—reviewer fuel! 🥕

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/parsers-fix

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7d9581 and 5633366.

📒 Files selected for processing (37)
  • apps/web/client/src/app/projects/import/local/_context/index.tsx (8 hunks)
  • apps/web/client/src/components/store/editor/font/font-config-manager.ts (3 hunks)
  • apps/web/client/src/components/store/editor/font/font-upload-manager.ts (3 hunks)
  • apps/web/client/src/components/store/editor/font/layout-manager.ts (2 hunks)
  • apps/web/client/src/components/store/editor/pages/helper.ts (1 hunks)
  • apps/web/client/src/components/store/editor/theme/util.ts (1 hunks)
  • packages/fonts/src/helpers/ast-generators.ts (1 hunks)
  • packages/fonts/src/helpers/ast-manipulators.ts (1 hunks)
  • packages/fonts/src/helpers/class-utils.ts (3 hunks)
  • packages/fonts/src/helpers/font-extractors.ts (1 hunks)
  • packages/fonts/src/helpers/import-export-manager.ts (1 hunks)
  • packages/fonts/src/helpers/validators.ts (1 hunks)
  • packages/fonts/src/utils.ts (1 hunks)
  • packages/fonts/test/ast-generators.test.ts (1 hunks)
  • packages/fonts/test/class-utils.test.ts (1 hunks)
  • packages/fonts/test/font-extractors.test.ts (1 hunks)
  • packages/fonts/test/validators.test.ts (1 hunks)
  • packages/growth/src/inject.ts (1 hunks)
  • packages/growth/src/remove.ts (2 hunks)
  • packages/parser/src/code-edit/group.ts (1 hunks)
  • packages/parser/src/code-edit/helpers.ts (1 hunks)
  • packages/parser/src/code-edit/image.ts (2 hunks)
  • packages/parser/src/code-edit/insert.ts (1 hunks)
  • packages/parser/src/code-edit/layout.ts (1 hunks)
  • packages/parser/src/code-edit/move.ts (1 hunks)
  • packages/parser/src/code-edit/next-config.ts (1 hunks)
  • packages/parser/src/code-edit/remove.ts (1 hunks)
  • packages/parser/src/code-edit/style.ts (1 hunks)
  • packages/parser/src/code-edit/text.ts (1 hunks)
  • packages/parser/src/code-edit/transform.ts (1 hunks)
  • packages/parser/src/helpers.ts (2 hunks)
  • packages/parser/src/ids.ts (1 hunks)
  • packages/parser/src/packages.ts (1 hunks)
  • packages/parser/src/parse.ts (2 hunks)
  • packages/parser/src/template-node/helpers.ts (1 hunks)
  • packages/parser/src/template-node/map.ts (4 hunks)
  • tooling/eslint/base.js (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel
Copy link

vercel bot commented Sep 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Sep 24, 2025 5:03pm
web Ready Ready Preview Comment Sep 24, 2025 5:03pm

@Kitenite Kitenite merged commit 55e0fb9 into main Sep 24, 2025
6 of 8 checks passed
@Kitenite Kitenite deleted the feat/parsers-fix branch September 24, 2025 17:01
This was referenced Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants