Repository navigation
refactor: replace inlined types with upstream deps - #4239
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughReplaces several local TypeScript type definitions with types imported from three newly added devDependencies; removes large Cloudflare Wrangler type modules; adjusts one runtime type assertion and makes a test tolerant of optional OpenAPI info fields. ChangesType extraction and replacement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
package.json (1)
87-103:⚠️ Potential issue | 🟠 MajorMove these packages to
dependencies, notdevDependencies.These modules are no longer build-only: the PR now exposes them through exported types via the public API surface. The export chain flows:
@apphosting/common→src/presets/firebase/types.ts→PresetOptions→src/types/config.ts→ public./typesexport@cloudflare/workers-utils→src/presets/cloudflare/types.ts→PresetOptions→src/types/config.ts→ public./typesexport@scalar/openapi-types→src/types/openapi-ts.ts→src/types/handler.ts→ public./typesexportIf they stay in
devDependencies, Nitro's emitted.d.tsfiles will reference packages that app consumers never install, causing downstreamCannot find module ...type-resolution failures.Suggested package move
"dependencies": { + "@apphosting/common": "^0.0.9", + "@cloudflare/workers-utils": "^0.18.0", + "@scalar/openapi-types": "^0.7.0", "consola": "^3.4.2", "crossws": "^0.4.5", "db0": "^0.3.4", @@ "devDependencies": { - "@apphosting/common": "^0.0.9", "@azure/functions": "^3.5.1", @@ - "@cloudflare/workers-utils": "^0.18.0", @@ - "@scalar/openapi-types": "^0.7.0",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package.json` around lines 87 - 103, The listed packages (`@apphosting/common`, `@cloudflare/workers-utils`, `@scalar/openapi-types` and the other shown modules) are referenced from the public exported typings and must be installed by consumers, so move them out of devDependencies into dependencies in package.json; update the package.json sections to place each of the referenced names (e.g., "@apphosting/common", "@cloudflare/workers-utils", "@scalar/openapi-types", "@deno/types", "@hiogawa/vite-plugin-fullstack", etc.) into the top-level "dependencies" object so the emitted .d.ts files resolve for downstream consumers.
🧹 Nitpick comments (1)
src/runtime/internal/routes/openapi.ts (1)
72-80: Prefer a checked object here instead ofas OperationObject.This cast removes compile-time validation at the point where route meta is turned into the published OpenAPI document. If the upstream Scalar types are stricter now, narrow
h.meta?.openAPIor introduce a local helper type instead of asserting the whole object; otherwise invalid operation shapes will silently pass type-checking.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/runtime/internal/routes/openapi.ts` around lines 72 - 80, The code currently force-casts the merged route entry to OperationObject (in the PathItemObject creation where "const item" is defined using [method] and spreading ...openAPI), which silences compile-time validation; replace the unchecked "as OperationObject" with a safe narrowing: validate or map h.meta?.openAPI into a locally defined stricter type (or optional partial) before spreading, e.g., create a helper that picks/validates allowed fields from openAPI and returns a properly typed OperationObject (or OperationObject | undefined) and use that helper when building the [method] entry so the compiler enforces the correct shape instead of an as-cast.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@package.json`:
- Around line 87-103: The listed packages (`@apphosting/common`,
`@cloudflare/workers-utils`, `@scalar/openapi-types` and the other shown modules)
are referenced from the public exported typings and must be installed by
consumers, so move them out of devDependencies into dependencies in
package.json; update the package.json sections to place each of the referenced
names (e.g., "@apphosting/common", "@cloudflare/workers-utils",
"@scalar/openapi-types", "@deno/types", "@hiogawa/vite-plugin-fullstack", etc.)
into the top-level "dependencies" object so the emitted .d.ts files resolve for
downstream consumers.
---
Nitpick comments:
In `@src/runtime/internal/routes/openapi.ts`:
- Around line 72-80: The code currently force-casts the merged route entry to
OperationObject (in the PathItemObject creation where "const item" is defined
using [method] and spreading ...openAPI), which silences compile-time
validation; replace the unchecked "as OperationObject" with a safe narrowing:
validate or map h.meta?.openAPI into a locally defined stricter type (or
optional partial) before spreading, e.g., create a helper that picks/validates
allowed fields from openAPI and returns a properly typed OperationObject (or
OperationObject | undefined) and use that helper when building the [method]
entry so the compiler enforces the correct shape instead of an as-cast.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 35e2f3ae-83be-4dcf-822b-a89f3a7a44d1
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
package.jsonsrc/presets/cloudflare/types.tssrc/presets/cloudflare/wrangler/_utils.tssrc/presets/cloudflare/wrangler/config.tssrc/presets/cloudflare/wrangler/environment.tssrc/presets/firebase/types.tssrc/runtime/internal/routes/openapi.tssrc/types/openapi-ts.tstest/presets/nitro-dev.test.ts
💤 Files with no reviewable changes (3)
- src/presets/cloudflare/wrangler/_utils.ts
- src/presets/cloudflare/wrangler/config.ts
- src/presets/cloudflare/wrangler/environment.ts
|
Can you please compare dist/ size difference? (are they tree-shaken?) |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
pi0
left a comment
There was a problem hiding this comment.
thnx! i confirmed bundle size is not changes singicifiantly (only ~5 new dts chunks)
for openapi types we likely use standlone types
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
🔗 Linked issue
#4215
❓ Type of change
📚 Description
Move from inlining a copy of types to sourcing them from their dependencies.
📝 Checklist