Skip to content

Commit 92d62c2

Browse files
committed
small changes
1 parent 12bcc15 commit 92d62c2

File tree

3 files changed

+0
-14
lines changed

3 files changed

+0
-14
lines changed

src/barrel.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ class BarrelFile {
9191
this.exportMapping = {};
9292
this.defaultPatternExport = new DefaultPatternExport();
9393
this.importMapping = {};
94-
this.defaultPatternExport.numOfDefaultPatternUsed = 0;
9594
}
9695

9796
handleExportNamedDeclaration(node) {
@@ -222,7 +221,6 @@ class BarrelFile {
222221
if (this.defaultPatternExport.numOfDefaultPatternUsed === 1) {
223222
this.exportMapping[this.defaultPatternExport.firstSpecifier.exportedName] = this.defaultPatternExport.firstSpecifier;
224223
this.defaultPatternExport = new DefaultPatternExport();
225-
this.defaultPatternExport.isDefaultPatternCreated = true;
226224
}
227225
delete this.defaultPatternExport.numOfDefaultPatternUsed;
228226
delete this.defaultPatternExport.firstSpecifier;

src/path.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,10 @@ class PathFunctions {
6666
}
6767

6868
static removeLastSegment(path) {
69-
// path.split("\\").slice(0,-1).join("\\");
70-
// substring is more performant than split, in a half of the time.
7169
return path.substring(0, ospath.normalize(path).lastIndexOf(ospath.sep));
7270
}
7371

7472
static getAbsolutePath(path, from=process.cwd()) {
75-
// https://github.com/nodejs/node/blob/main/doc/api/modules.md#loading-from-node_modules-folders
76-
// solution for require function for ES modules
77-
// https://stackoverflow.com/questions/54977743/do-require-resolve-for-es-modules
78-
// https://stackoverflow.com/a/50053801
79-
// import { createRequire } from "module";
80-
// const require = createRequire(import.meta.url);
8173
if (ospath.isAbsolute(path)) return path;
8274
let currentDir = from;
8375
if (!PathFunctions.isNodeModule(path)) return ospath.join(currentDir, path);

src/resolver.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ class Resolver {
2626
}
2727

2828
getTargetPathType(target, from) {
29-
// if(isFromLocal && isToPackage) isCJS
30-
// if(isFromLocal && isToLocal) isESM
31-
// if(isFromPackage && isToPackage) isESM
3229
if (this.isExtensionFile(target, "cjs") || (!PathFunctions.isNodeModule(from) && PathFunctions.isNodeModule(target) && !this.isExtensionFile(target, "mjs"))) {
3330
return "CJS";
3431
} else {
@@ -67,7 +64,6 @@ class Resolver {
6764

6865
getFilePathWithExtension(path) {
6966
const ext = this.extensions.find((ext)=> PathFunctions.fileExists(path + ext));
70-
// can't use "if (!ext)" because ext can be equal to empty string that in this case should be true, but for javascript it's false
7167
if (ext === undefined) return null;
7268
const resolvedPath = path + ext;
7369
return resolvedPath;

0 commit comments

Comments
 (0)