Skip to content

[codex] fix re-exported class method prefixes#4274

Draft
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-nestjs-reexport-method-symbols
Draft

[codex] fix re-exported class method prefixes#4274
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-nestjs-reexport-method-symbols

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Summary

  • Canonicalize ImportedClass.source_prefix through the class defining path for namespace imports, namespace re-exports, and named imports.
  • Keep existing barrel/effective prefixes for non-class import metadata while using the defining module prefix for class method symbols.
  • Add an RxJS-style barrel regression where Subject imports Observable via the package index and inherited methods are exercised.

Root Cause

exported_classes can map barrel names to class objects emitted from internal modules. The importer was storing the barrel/effective module prefix in ImportedClass.source_prefix, so generated call sites could reference method symbols with the barrel prefix instead of the module that emitted those methods.

Validation

  • cargo build --release --quiet -p perry -p perry-runtime -p perry-stdlib
  • cargo test --release -p perry canonical_class_source_prefix_prefers_defining_path -- --nocapture
  • ./target/release/perry test-files/test_issue_1021_rxjs_reexport_methods.ts -o /tmp/perry_issue_1021_reexport_methods_after && /tmp/perry_issue_1021_reexport_methods_after
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh

Notes

I also tried the current tests/release/packages/nestjs-hello fixture with this branch. It now stops before link/codegen at the V8-free JS dependency gate for Express/Multer-side dependencies such as tslib, uid, iterare, fast-safe-stringify, path-to-regexp, cors, express, and multer, so this PR does not claim an end-to-end NestJS pass.

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.

1 participant