Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,22 @@ precinct.paperwork = (filename, options = {}) => {

if (!options.includeCore) {
return deps.filter((dep) => {
if (dep.startsWith('node:')) {
// If `identifiers: true` was passed, we'll get results objects with `path`, otherwise strings.
const depPath = dep.path || dep;

if (depPath.startsWith('node:')) {
return false
}

// In nodejs 18, node:test is a builtin but shows up under natives["test"], but
// can only be imported by "node:test." We're correcting this so "test" isn't
// unnecessarily stripped from the imports
if ("test" == dep) {
if ("test" == depPath) {
debug('paperwork: allowing test import to avoid builtin/natives consideration\n');
return true
}

const isInNatives = Boolean(natives[dep]);
const isInNatives = Boolean(natives[depPath]);
return !isInNatives;
});
}
Expand Down