Skip to content

finding: the prerequisite refusal strips only .mjs when deriving the gate name, so the first .mts consumer prints its extension #15864

Description

@claude

Measured while converting the last seven unconverted importers in #15783 (PR #15862), which added the first .mts consumer of scripts/import-prerequisite.mjs.

What happens

prerequisiteNotMetText derives the name it prints from the importer's path:

const gate = fileURLToPath(importerUrl).split('/').pop().replace(/\.mjs$/, '');

Only .mjs is stripped. Every consumer until now was .mjs, so this was invisible. With a .mts consumer the refusal prints the extension:

$ node scripts/check-exported-any-returns.mts ; echo EXIT=$?
check-exported-any-returns.mts: PREREQUISITE NOT MET — the dependency `typescript` is not installed
EXIT=3

against the sibling shape on the same tree, same run:

$ node scripts/check-comment-mask-corpus.mjs ; echo EXIT=$?
check-comment-mask-corpus: PREREQUISITE NOT MET — the dependency `@typescript-eslint/parser` is not installed
EXIT=3

Why it is small, and why it is still worth a row

Cosmetic: the exit code, the named package, the "nothing was measured" clause and the node PATH.log command line are all correct, and the command line the text hands the reader keeps its real extension either way (/tmp/check-exported-any-returns.mts.log is a writable path). Nothing reads that name programmatically as far as this observation goes — that was not swept.

What it costs is that the printed identifier stops being the gate's NAME and becomes a filename, in the one message a reader is meant to quote back. The population is derivable rather than recalled: any consumer of import-prerequisite.mjs authored in TypeScript. Today that is one.

Re-check

  • git grep -n "replace(/\\\\.mjs\\$/" -- scripts/import-prerequisite.mjs
  • In a worktree with no node_modules: node scripts/check-exported-any-returns.mts > /tmp/g.log 2>&1; echo EXIT=$? — capture BEFORE any pipe.

Not asserted

No claim about which spelling is right. .mts could be stripped alongside .mjs, or the extension could be kept deliberately for a .mts gate that a reader will invoke with the extension. That is a decision, not a defect with one answer.

Related

#15783 (the class, and the card that produced this observation) - PR #15862 - #11557 - #13983 (the exit code of this same frame)


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions