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
19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "vasta-orm",
"version": "0.0.13",
"version": "0.0.14",
"description": "Active record ORM built on top of Kysely",
"type": "module",
"author": "David Nahodyl <david.nahodyl@gmail.com>",
"license": "MIT",
"files": [
"dist"
"dist",
"src"
],
"repository": {
"type": "git",
Expand All @@ -24,10 +25,14 @@
],
"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 on lines 26 to +35
}
Comment on lines +28 to 36

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.

},
"scripts": {
Expand All @@ -53,7 +58,7 @@
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"types": "src/index.ts",
"devDependencies": {
"@eslint/js": "^9.39.4",
"@types/node": "^24.12.4",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { defineModel, RequireSelected } from "@src/model/Model";
import { defineModel, RequireSelected } from "./model/Model";

export { defineModel, RequireSelected };
2 changes: 1 addition & 1 deletion src/model/Builder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Kysely, Expression, ExpressionBuilder, AliasedExpression, ComparisonOperatorExpression } from "kysely";
import { Model } from "@src/model/Model";
import { Model } from "./Model.js";

export type Bivariant<T> = {
[K in keyof T]: T[K] extends (...args: infer A) => infer R
Expand Down
2 changes: 1 addition & 1 deletion src/model/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Insertable, Kysely, Selectable, Updateable } from "kysely";
import { RelationBuilder, AnyModelConstructor } from "./Builder.js";
import { StaticForwarder } from "./StaticForwarder.js";
import { getCallerMethodName } from "@src/util/caller";
import { getCallerMethodName } from "../util/caller.js";

export type ModelLifecycleEventName =
| "creating"
Expand Down
Loading