Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
alicewriteswrongs committed Jun 21, 2023
1 parent b491542 commit b3f6a40
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/compiler/sys/in-memory-fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const createInMemoryFs = (sys: d.CompilerSystem) => {
const emptyDirs = async (dirs: string[]): Promise<void> => {
dirs = dirs
.filter(isString)
.map(s => normalizePath(s))
.map((s) => normalizePath(s))
.reduce((dirs, dir) => {
if (!dirs.includes(dir)) {
dirs.push(dir);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transpile/run-program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const runTsProgram = async (
const srcRootDtsFiles = tsProgram
.getRootFileNames()
.filter((f) => f.endsWith('.d.ts') && !f.endsWith('components.d.ts'))
.map(s => normalizePath(s))
.map((s) => normalizePath(s))
.filter((f) => !emittedDts.includes(f))
.map((srcRootDtsFilePath) => {
const relativeEmitFilepath = relative(config.srcDir, srcRootDtsFilePath);
Expand Down
6 changes: 3 additions & 3 deletions src/utils/normalize-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @param relativize whether or not a relative path should have `./` prepended
* @returns the converted path
*/
export const normalizePath = (path: string, relativize= true): string => {
export const normalizePath = (path: string, relativize = true): string => {
if (typeof path !== 'string') {
throw new Error(`invalid path to normalize`);
}
Expand All @@ -27,8 +27,8 @@ export const normalizePath = (path: string, relativize= true): string => {
secondPart &&
path.includes('/') &&
!secondPart.startsWith('.') &&
!secondPart.startsWith('@') &&
relativize
!secondPart.startsWith('@') &&
relativize
) {
return './' + normalized;
}
Expand Down
8 changes: 4 additions & 4 deletions src/utils/test/normalize-path.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ describe('normalizePath', () => {
});

it('relative, no dot', () => {
expect(normalizePath("foo/bar.ts")).toBe("./foo/bar.ts");
expect(normalizePath("foo/bar.ts", false)).toBe("foo/bar.ts");
expect(normalizePath("foo\\bar.ts")).toBe("./foo/bar.ts");
expect(normalizePath("foo\\bar.ts", false)).toBe("foo/bar.ts");
expect(normalizePath('foo/bar.ts')).toBe('./foo/bar.ts');
expect(normalizePath('foo/bar.ts', false)).toBe('foo/bar.ts');
expect(normalizePath('foo\\bar.ts')).toBe('./foo/bar.ts');
expect(normalizePath('foo\\bar.ts', false)).toBe('foo/bar.ts');
});

it('absolute win32', () => {
Expand Down

0 comments on commit b3f6a40

Please sign in to comment.