Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: identifiers #110

Closed
wants to merge 1 commit into from
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