-
Notifications
You must be signed in to change notification settings - Fork 35
Pc/switch module resolution #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ | |
| ], | ||
| "exports": { | ||
| ".": { | ||
| "types": "./index.ts", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
pkg="packages/lifecycle"
echo "== package metadata =="
jq '{files, exports: .exports["."]}' "$pkg/package.json"
echo "== source/declaration presence on disk =="
[ -f "$pkg/index.ts" ] && echo "has $pkg/index.ts" || echo "missing $pkg/index.ts"
[ -f "$pkg/dist/index.d.ts" ] && echo "has $pkg/dist/index.d.ts" || echo "missing $pkg/dist/index.d.ts"
echo "== files that would be published (dry run) =="
(
cd "$pkg"
npm pack --dry-run --json \
| jq -r '.[0].files[].path' \
| rg -n '^(index\.ts|dist/index\.d\.ts)$' || true
)Repository: knockout/tko Length of output: 404 🏁 Script executed: fd -t f "Makefile" packages/lifecycleRepository: knockout/tko Length of output: 83 🏁 Script executed: cat packages/lifecycle/MakefileRepository: knockout/tko Length of output: 87 🏁 Script executed: rg "dts|declaration" packages/lifecycle --type ts --type js --type json -A 2Repository: knockout/tko Length of output: 38 🏁 Script executed: cat ../../tools/build.mk 2>/dev/null || cat tools/build.mkRepository: knockout/tko Length of output: 3631 🏁 Script executed: find . -name "tsconfig.json" -type f | head -20Repository: knockout/tko Length of output: 71 🏁 Script executed: cat tsconfig.jsonRepository: knockout/tko Length of output: 1192 🏁 Script executed: grep -r "dts" tools/ --include="*.mk" --include="*.mjs"Repository: knockout/tko Length of output: 38 🏁 Script executed: grep -r "\.d\.ts" packages/lifecycle/Repository: knockout/tko Length of output: 38 🏁 Script executed: ls -la packages/lifecycle/dist/ 2>/dev/null || echo "dist/ does not exist"Repository: knockout/tko Length of output: 76 🏁 Script executed: find packages/ -name "Makefile" -type f | head -5 | xargs grep -l "dts" 2>/dev/null || echo "No dts targets found in package Makefiles"Repository: knockout/tko Length of output: 97 🏁 Script executed: rg "declaration" packages/*/package.json | head -10Repository: knockout/tko Length of output: 38 🏁 Script executed: cat packages/lifecycle/package.json | grep -A 10 "exports"Repository: knockout/tko Length of output: 294
Line 38 sets The suggested fix Recommended solutions:
🤖 Prompt for AI Agents |
||
| "require": "./dist/index.cjs", | ||
| "import": "./dist/index.js" | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |||||||||||||
| ], | ||||||||||||||
| "exports": { | ||||||||||||||
| ".": { | ||||||||||||||
| "types": "./index.ts", | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Verify packages where exports["."].types points to ./index.ts while files whitelist omits it.
fd -p 'package.json' packages | while read -r f; do
types_path="$(jq -r '.exports["."].types // empty' "$f")"
[ -z "$types_path" ] && continue
pkg_dir="$(dirname "$f")"
rel="${types_path#./}"
has_file="no"
[ -f "$pkg_dir/$rel" ] && has_file="yes"
includes_root_index_ts="$(jq -r '.files[]? // empty' "$f" | rg -n '^index\.ts$' || true)"
if [ "$types_path" = "./index.ts" ]; then
echo "$f :: types=$types_path :: file_exists=$has_file :: files_mentions_index_ts=$([ -n "$includes_root_index_ts" ] && echo yes || echo no)"
fi
doneRepository: knockout/tko Length of output: 2679 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Examine the target package file
cat -n packages/provider.databind/package.json
# Check if dist/index.d.ts exists in the target package
ls -la packages/provider.databind/dist/ 2>/dev/null | head -20 || echo "dist/ not found or is empty"
# Check another package as well to understand the pattern
echo "---"
cat -n packages/bind/package.json | head -50Repository: knockout/tko Length of output: 2728 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Check if any packages correctly point types to dist/index.d.ts
fd -p 'package.json' packages | while read -r f; do
types_path="$(jq -r '.exports["."].types // empty' "$f")"
if [[ "$types_path" == *"dist"* ]]; then
echo "CORRECT: $f :: types=$types_path"
fi
done
echo "---"
# Check what files exist in a typical source package (not dist)
echo "Source files in packages/provider.databind/:"
find packages/provider.databind -type f -name "*.ts" -o -name "*.tsx" | head -10
echo "---"
# Check if there's a Makefile that builds dist and generates declarations
ls -la packages/provider.databind/ | grep -i makefile
head -20 packages/provider.databind/Makefile 2>/dev/null || echo "Makefile not readable"Repository: knockout/tko Length of output: 387
Line 29 points to Proposed fix ".": {
- "types": "./index.ts",
+ "types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.js"
},This issue affects all 26 packages in the monorepo with the same pattern—each exports 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| "require": "./dist/index.cjs", | ||||||||||||||
| "import": "./dist/index.js" | ||||||||||||||
| }, | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: knockout/tko
Length of output: 477
🏁 Script executed:
Repository: knockout/tko
Length of output: 766
🏁 Script executed:
Repository: knockout/tko
Length of output: 1673
🏁 Script executed:
Repository: knockout/tko
Length of output: 2999
🏁 Script executed:
Repository: knockout/tko
Length of output: 175
🏁 Script executed:
Repository: knockout/tko
Length of output: 4303
exports["."].typespoints to a file that won't be published.The exports configuration lists
"types": "./index.ts", but this package only publishesdist/andhelpers/via thefilesarray. This will cause type resolution to fail for consumers after the package is published.This affects all packages:
packages/builder,packages/utils,builds/knockout, andbuilds/reference.The suggested fix of using
./dist/index.d.tswon't work—those files don't currently exist and aren't generated by the build pipeline. Declaration generation needs to be implemented: either by adding per-package.d.tsemission, updating thefilesarray to includeindex.ts(which exposes source code), or removing thetypesexport until declarations are properly built.🤖 Prompt for AI Agents