Skip to content

Commit

Permalink
More consistent comments
Browse files Browse the repository at this point in the history
  • Loading branch information
osyrisrblx committed Sep 10, 2024
1 parent 99243a7 commit 84ff8d4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/PathTranslator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class PathTranslator {
const pathInfo = PathInfo.from(filePath);

if ((pathInfo.extsPeek() === TS_EXT || pathInfo.extsPeek() === TSX_EXT) && pathInfo.extsPeek(1) !== D_EXT) {
pathInfo.exts.pop(); // pop .tsx?
pathInfo.exts.pop(); // pop .ts(x)

// index -> init
if (pathInfo.fileName === INDEX_NAME) {
Expand All @@ -81,24 +81,24 @@ export class PathTranslator {

/**
* Maps an input path to an output .d.ts path
* - `.tsx?` && !`.d.tsx?` -> `.d.ts`
* - `.ts(x)` && !`.d.ts(x)` -> `.d.ts`
* - `src/*` -> `out/*`
*/
public getOutputDeclarationPath(filePath: string) {
const makeRelative = this.makeRelativeFactory();
const pathInfo = PathInfo.from(filePath);

if ((pathInfo.extsPeek() === TS_EXT || pathInfo.extsPeek() === TSX_EXT) && pathInfo.extsPeek(1) !== D_EXT) {
pathInfo.exts.pop(); // pop .tsx?
pathInfo.exts.pop(); // pop .ts(x)
pathInfo.exts.push(DTS_EXT);
}

return makeRelative(pathInfo);
}

/**
* Maps an input path to an output .transformed.tsx? path
* - `.tsx?` -> `.transformed.tsx?`
* Maps an input path to an output .transformed.ts(x) path
* - `.ts(x)` -> `.transformed.ts(x)`
* - `src/*` -> `out/*`
*/
public getOutputTransformedPath(filePath: string) {
Expand Down Expand Up @@ -165,7 +165,7 @@ export class PathTranslator {

if (this.declaration) {
if ((pathInfo.extsPeek() === TS_EXT || pathInfo.extsPeek() === TSX_EXT) && pathInfo.extsPeek(1) === D_EXT) {
const tsExt = pathInfo.exts.pop(); // pop .tsx?
const tsExt = pathInfo.exts.pop(); // pop .ts(x)
assert(tsExt);
pathInfo.exts.pop(); // pop .d

Expand Down Expand Up @@ -198,7 +198,7 @@ export class PathTranslator {
const pathInfo = PathInfo.from(filePath);

if (pathInfo.extsPeek() === TS_EXT || pathInfo.extsPeek() === TSX_EXT) {
pathInfo.exts.pop(); // pop .tsx?
pathInfo.exts.pop(); // pop .ts(x)
if (pathInfo.extsPeek() === D_EXT) {
pathInfo.exts.pop(); // pop .d
}
Expand Down

0 comments on commit 84ff8d4

Please sign in to comment.