Skip to content

changed some paths and included src to improve types#10

Merged
Smef merged 1 commit into
mainfrom
intellisense-typesafety-improvements
May 21, 2026
Merged

changed some paths and included src to improve types#10
Smef merged 1 commit into
mainfrom
intellisense-typesafety-improvements

Conversation

@Smef

@Smef Smef commented May 21, 2026

Copy link
Copy Markdown
Owner

changed some paths and included src to improve types

Summary by CodeRabbit

  • New Features

    • Added StaticForwarder to the public API exports.
  • Chores

    • Bumped version to 0.0.14.
    • Updated package publishing configuration to include source files alongside built artifacts.
    • Modified type definition source references.

Review Change Stack

Copilot AI review requested due to automatic review settings May 21, 2026 18:49
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Smef has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 37 minutes and 31 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cb172bd8-6a26-49ef-989c-354a83983fa6

📥 Commits

Reviewing files that changed from the base of the PR and between 8db02b8 and 5c4d08d.

📒 Files selected for processing (4)
  • package.json
  • src/index.ts
  • src/model/Builder.ts
  • src/model/Model.ts
📝 Walkthrough

Walkthrough

This PR transitions the package from publishing built declarations in dist/ to publishing source files in src/. The entry point switches to ESM barrel re-exports, exports StaticForwarder, updates internal imports from @src aliases to relative paths, and changes the defineModel return type to use StaticForwarder's static members.

Changes

Source-first publication strategy

Layer / File(s) Summary
Package publication configuration
package.json
Version bumped to 0.0.14, published files extended to include src/, and type entry points (top-level and conditional exports) changed from dist/esm/index.d.ts to src/index.ts.
Entry point barrel exports and StaticForwarder
src/index.ts
Entry point switches to ESM barrel re-exports (export * from ./model/Builder.js and ./model/Model.js) and adds explicit export of StaticForwarder from ./model/StaticForwarder.js.
Internal import path migration
src/model/Builder.ts, src/model/Model.ts
Imports updated to use relative paths (./Model.js, ../util/caller.js) instead of @src alias paths.
defineModel return type update
src/model/Model.ts
Return type cast for defineModel factory changes to intersect with Omit<typeof StaticForwarder, "prototype"> instead of a mapped type over BaseModel's keys, making the public type signature reference StaticForwarder.

🎯 2 (Simple) | ⏱️ ~12 minutes

Hops of code, ears perked high,
From dist to src, watch it fly!
Static forwarders lead the way,
Relative paths save the day! 🐰✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'changed some paths and included src to improve types' is vague and uses generic language ('changed some paths') without specifying the key changes or their purpose clearly. Consider a more specific title that clearly describes the main change, such as 'Update import paths to use relative modules and point types to source files' or 'Refactor exports to source files and update import path references'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch intellisense-typesafety-improvements

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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 21, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
vasta-docs 5c4d08d Commit Preview URL

Branch Preview URL
May 21 2026, 07:14 PM

@Smef Smef force-pushed the intellisense-typesafety-improvements branch from 8db02b8 to 914cb5a Compare May 21, 2026 18:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Around line 28-36: Update the package export/type mapping so consumers use
emitted declaration files instead of TS sources: change the "exports" mapping
keys referenced in package.json (specifically the "import.types" and
"require.types" entries and the top-level "types" field) to point to the built
.d.ts files produced in your dist output (e.g., the ESM .d.ts under dist/esm and
the CJS .d.ts under dist/cjs) rather than ./src/index.ts, and only publish src/
if you intentionally want source included.

In `@src/index.ts`:
- Around line 1-3: Replace the blanket re-exports with an explicit public API:
stop using `export *` and instead re-export the specific symbols intended to be
public (e.g., Bivariant, ModelLike, AnyModelConstructor, SelectedModel,
ExtractDB, ExtractTB, ExtractSelection, PrimaryKeyValue, RelationKeys,
WithConstraints, Builder, RelationBuilder, lifecycle types, Model, defineModel,
RequireSelected, etc.) from the `Builder` and `Model` modules so accidental
internals don't leak; also explicitly re-export the default export from the
builder module as the package default (for example via a `export { default }
from "./model/Builder.js";`) and keep the existing `StaticForwarder` named
export as-is. Ensure all referenced symbols (Builder, Model, StaticForwarder and
the listed type names) are included in the explicit export lists.

In `@src/model/Model.ts`:
- Around line 585-587: The return-cast expression at the end of the Model.ts
signature keeps the trailing Omit<> on the same line; reflow the cast so the
Omit<typeof StaticForwarder, "prototype"> begins on a new line to match
surrounding formatting. Locate the return that casts BaseModel (the expression
containing ModelConstructorArgs<Insertable<DB[TB]>, DefaultedInsertable> and
Selectable<DB[TB]>) and break the line before the final ") & Omit<typeof
StaticForwarder, \"prototype\">", ensuring indentation aligns with the rest of
the signature and preserves the existing types (BaseModel, ModelConstructorArgs,
Insertable, DB, TB, DefaultedInsertable, Selectable).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 96be8a5d-cf07-4140-a48d-3218af19eb6f

📥 Commits

Reviewing files that changed from the base of the PR and between f37684f and 8db02b8.

📒 Files selected for processing (4)
  • package.json
  • src/index.ts
  • src/model/Builder.ts
  • src/model/Model.ts

Comment thread package.json
Comment on lines +28 to 36
"import": {
"types": "./src/index.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./src/index.ts",
"default": "./dist/cjs/index.js"
}
}

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 | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inventory what will actually be published from src/ and check for non-public files.
fd . src -t f | head -200
fd -e ts -e tsx . src | xargs -I {} sh -c 'echo "--- {} ---"; head -1 "{}"' | head -100
# Check whether project relies on path aliases that won't resolve for consumers
rg -nP '"paths"\s*:' tsconfig.json tsconfig.cjs.json 2>/dev/null
rg -nP 'from\s+["'\'']@' src

Repository: Smef/vasta

Length of output: 601


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== package.json (exports + files/publishConfig) ==="
node -p "JSON.stringify(require('./package.json').exports, null, 2)" 2>/dev/null || true
node -p "JSON.stringify(require('./package.json').files ?? null, null, 2)" 2>/dev/null || true
node -p "JSON.stringify(require('./package.json').publishConfig ?? null, null, 2)" 2>/dev/null || true
echo
echo "=== package.json raw lines 20-60 ==="
nl -ba package.json | sed -n '20,70p'

echo
echo "=== tsconfig.json (compilerOptions relevant bits) ==="
nl -ba tsconfig.json | sed -n '1,120p'

echo
echo "=== tsconfig.cjs.json (if present) ==="
if [ -f tsconfig.cjs.json ]; then nl -ba tsconfig.cjs.json | sed -n '1,140p'; else echo "tsconfig.cjs.json not found"; fi

echo
echo "=== Does repo include generated declaration output? (dist) ==="
if [ -d dist ]; then
  fd -e d.ts . dist | head -200
else
  echo "dist/ not found"
fi

echo
echo "=== rg: sources referenced by exports types/default ==="
rg -n '"(types|default)"\s*:\s*"\./' package.json

Repository: Smef/vasta

Length of output: 441


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== package.json (exports + files/publishConfig) ==="
node -p "JSON.stringify(require('./package.json').exports, null, 2)" 2>/dev/null || true
node -p "JSON.stringify(require('./package.json').files ?? null, null, 2)" 2>/dev/null || true
node -p "JSON.stringify(require('./package.json').publishConfig ?? null, null, 2)" 2>/dev/null || true
echo
echo "=== package.json raw lines 20-80 ==="
cat -n package.json | sed -n '20,80p'

echo
echo "=== tsconfig.json (compilerOptions relevant bits) ==="
cat -n tsconfig.json | sed -n '1,160p'

echo
echo "=== tsconfig.cjs.json (if present) ==="
if [ -f tsconfig.cjs.json ]; then cat -n tsconfig.cjs.json | sed -n '1,200p'; else echo "tsconfig.cjs.json not found"; fi

echo
echo "=== Does repo include generated declaration output? (dist) ==="
if [ -d dist ]; then
  fd -e d.ts . dist | head -200
  echo
  echo "=== dist/esm and dist/cjs top-level files ==="
  find dist -maxdepth 3 -type f \( -name "*.d.ts" -o -name "index.js" -o -name "index.mjs" -o -name "index.cjs" \) | head -200
else
  echo "dist/ not found"
fi

echo
echo "=== package.json: is src/ included in publish? (files array) ==="
node -p "require('./package.json').files" 2>/dev/null || true
echo

echo
echo "=== rg: sources referenced by exports types/default ==="
rg -n '"(types|default)"\s*:\s*"\./' package.json || true

echo
echo "=== rg: declaration emit settings ==="
rg -n 'declaration|emitDeclarationOnly|outDir|declarationDir|rootDir|moduleResolution|baseUrl|paths' tsconfig*.json || true

echo
echo "=== dist: sample generated index declarations if present ==="
if [ -d dist ]; then
  fd 'index.d.ts' dist -a | head -20
  fd -e d.ts dist/esm dist/cjs 2>/dev/null | head -50
fi

Repository: Smef/vasta

Length of output: 4171


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Any test/fixture-like files under src/ that would get published? ==="
fd -t f . src \
  | rg -i '(__tests__|test|spec|fixture|fixtures|mock)' || true

echo
echo "=== List declaration outputs if present (dist may not exist in repo snapshot) ==="
if [ -d dist ]; then
  fd -e d.ts dist | head -200
else
  echo "dist/ not present (but build script generates dist before publish)."
fi

echo
echo "=== tsconfig.esm.json (if present) ==="
if [ -f tsconfig.esm.json ]; then
  cat -n tsconfig.esm.json | sed -n '1,200p'
else
  echo "tsconfig.esm.json not found"
fi

Repository: Smef/vasta

Length of output: 481


Point types to emitted .d.ts instead of src/index.ts
package.json sets exports["."].import.types, exports["."].require.types, and top-level types to ./src/index.ts, and it also publishes src/. With this setup, TS consumers type-check against your source under their own compiler options rather than consuming the generated declaration files from dist (your build config has declaration: true and outputs to dist/esm + dist/cjs). This can widen the effective public surface via deep imports and can lead to type/runtime interop mismatches for require since its types still come from the ESM source.
Consider pointing import.types to the emitted ESM .d.ts and require.types to the emitted CJS .d.ts, and only publish src/ if you explicitly want sources available.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 28 - 36, Update the package export/type mapping so
consumers use emitted declaration files instead of TS sources: change the
"exports" mapping keys referenced in package.json (specifically the
"import.types" and "require.types" entries and the top-level "types" field) to
point to the built .d.ts files produced in your dist output (e.g., the ESM .d.ts
under dist/esm and the CJS .d.ts under dist/cjs) rather than ./src/index.ts, and
only publish src/ if you intentionally want source included.

Comment thread src/index.ts Outdated
Comment thread src/model/Model.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts module paths/exports and changes the package’s published type entrypoints to come from src (instead of generated .d.ts) with the stated goal of improving consumer type quality.

Changes:

  • Switched internal imports from @src/* aliases to relative .js-suffixed paths for ESM compatibility.
  • Updated the root src/index.ts to re-export the model modules (and StaticForwarder) via wildcard exports.
  • Modified package.json publish/exports configuration to include src in the published files and point types/exports.*.types to ./src/index.ts (and bumped version to 0.0.14).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/model/Model.ts Replaces @src import with relative import; refines defineModel return static typing.
src/model/Builder.ts Replaces @src import with relative import.
src/index.ts Changes package entry exports to wildcard re-exports of Builder/Model plus StaticForwarder.
package.json Publishes src, updates exports to conditional types targets, and points types to src/index.ts.
Comments suppressed due to low confidence (1)

package.json:61

  • "types": "src/index.ts" makes the top-level typings entry depend on TS source in the published package. If the goal is better consumer typings, prefer "types" pointing at the emitted declaration file(s) in dist so consumers don’t need to resolve/parse TS implementation files from node_modules.
  "main": "dist/cjs/index.js",
  "module": "dist/esm/index.js",
  "types": "src/index.ts",

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
Comment on lines 26 to +35
"exports": {
".": {
"types": "./dist/esm/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"default": "./dist/cjs/index.js"
"import": {
"types": "./src/index.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./src/index.ts",
"default": "./dist/cjs/index.js"
}
Comment thread src/index.ts Outdated
@Smef Smef force-pushed the intellisense-typesafety-improvements branch from 914cb5a to 5c4d08d Compare May 21, 2026 19:11
@Smef Smef merged commit 9802741 into main May 21, 2026
1 of 3 checks passed
@Smef Smef deleted the intellisense-typesafety-improvements branch May 21, 2026 19:12
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