`paperwork()` returns no dependencies for `.mts` and `.cts` files
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, node.js, typescript
- Domain
- backend, developer-experience
Research direction
Start by tracing how paperwork() derives the file type and how getDetective selects a parser for .ts files; compare those paths with .mts and .cts. The examples in the issue reproduce the missing dependencies, including the expected outputs. Add support for those extensions and verify that the shown .mts and .cts imports are detected while existing .ts and .mjs behavior remains intact.
Written by the indexing model from the issue text.
Description
precinct.paperwork() returns [] for TypeScript files with the .mts or .cts extension, while the same content in a .ts file is parsed. Tools built on precinct (dependency-tree, madge) therefore see no dependencies in these files.
// a.mts (a.ts has the same content)
import { b } from "./b.mts";
export const a: number = b + 1;
// c.cts
const { b } = require("./b.cjs");
const c: number = b;
module.exports = { c };
// check.mjs
import { paperwork } from "precinct";
for (const f of ["a.ts", "a.mts", "c.cts", "d.mjs"]) console.log(f, paperwork(f, { includeCore: false }));
d.mjs contains import fs from "node:fs"; import x from "./x.js";.
$ node check.mjs
a.ts [ './b.mts' ]
a.mts []
c.cts []
d.mjs [ './x.js' ]
Expected: a.mts [ './b.mts' ] and c.cts [ './b.cjs' ].
With madge 8.0.0, madge("a.mts", { fileExtensions: ["mts", "ts"] }) gives {"a.mts":[]}, and a.ts gives {"a.ts":["b.mts"],"b.mts":[]}.
Tested with precinct 13.0.1 (also 12.3.2 as used by dependency-tree 11.5.0) and main (f9512ad), Node.js 26.13.0.
Cause: paperwork sets type to the extension without the dot (mts, cts), and getDetective has no case for these, so no detective runs. Mapping them to ts (or .cts with mixedImports) like .cjs is mapped to commonjs would fix it.
Credit: https://ucsbplse.github.io/
- Dominant language
- JavaScript
- Stars
- 234
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dependents/node-precinct
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dependents/node-precinct#46 · 3 comments ·
-
enhancement help wanted
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dependents/node-precinct#42 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
dependents/node-precinct#35 · 3 comments ·
All issues in dependents/node-precinct
Similar issues
-
🐛 bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
LibreChat-AI/LibreChat#17887 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
liveshowy/webauthn_components#118 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
showdownjs/showdown#1113 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
volumio/volumio-plugins-sources-bookworm#279 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100