vercel-labs / vercel-labs/konsistent

Honor `from` for constant export predicates

Open
#74 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
176
Forks
6
Avg merge
20h 26m
Merged PRs (30d)
11

Description

exportConstants accepts definition objects with a from field in the generated schema, but its evaluator ignores from and only recognizes exports parsed directly as local const declarations. Constant re-exports therefore cannot be constrained by module source as the schema suggests.

Relevant files:

  • packages/konsistent/src/typescript/predicates/export-constants.ts
  • packages/konsistent/src/typescript/predicates/export-constants.test.ts
  • packages/konsistent/src/typescript/parser.ts
  • packages/konsistent/konsistent.schema.json
  • docs/reference/predicates.md

Honor from using the same module-source matching semantics as export and exportTypes, including re-exports, and add coverage for correct, incorrect, and missing module sources. Apply structural schema checks only when a local constant declaration is available.

Backward compatibility: internal code and documentation can be refactored without compatibility shims. Keep the existing from config field; no schema rename is needed. If a replacement field is introduced, retain from and its prior behavior as deprecated and emit a non-failing CLI warning when it is used.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/konsistent/src/typescript/predicates/export-constants.ts and compare its handling with export and exportTypes, then inspect parser.ts for module-source information. Extend export-constants.test.ts to cover correct, incorrect, and missing sources, including re-exports. Done means the existing schema and docs remain aligned and structural checks apply only when a local declaration is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.