-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3cd80f1
commit 5575cb0
Showing
7 changed files
with
72 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { defineBuildConfig } from "unbuild"; | ||
import { defineBuildConfig } from 'unbuild' | ||
|
||
export default defineBuildConfig({ | ||
entries: ["src/index.ts", "src/cli.ts"], | ||
entries: ['src/index.ts', 'src/cli.ts'], | ||
declaration: true, | ||
rollup: { | ||
emitCJS: true, | ||
esbuild: { | ||
target: "esnext", | ||
} | ||
} | ||
}); | ||
target: 'esnext', | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { readFile } from 'fs/promises'; | ||
import { parseTscOutput } from './index.js'; | ||
import { resolve } from 'path'; | ||
/* eslint-disable no-console */ | ||
import { readFile } from 'node:fs/promises' | ||
import { resolve } from 'node:path' | ||
import { parseTscOutput } from './index.js' | ||
|
||
async function run() { | ||
let tscOutput | ||
try { | ||
tscOutput = await readFile(resolve(__dirname, '..', 'tsc-output.log'), 'utf8'); | ||
} catch (error) { | ||
throw new Error('Could not read tsc-output.log'); | ||
tscOutput = await readFile(resolve(__dirname, '..', 'tsc-output.log'), 'utf8') | ||
} | ||
catch (error) { | ||
throw new Error('Could not read tsc-output.log') | ||
} | ||
|
||
const parsedTscOutput = parseTscOutput(tscOutput) | ||
console.log(parsedTscOutput) | ||
} | ||
|
||
run() | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export type TscDiagnostic = { | ||
path: string, | ||
cursor: { line: number, column: number }, | ||
tsCode: string, | ||
export interface TscDiagnostic { | ||
path: string | ||
cursor: { line: number, column: number } | ||
tsCode: string | ||
error: string | ||
} | ||
|
||
export type TypestepConfig = { | ||
export interface TypestepConfig { | ||
ignoredFiles?: string[] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import jiti from "jiti"; | ||
import process from 'node:process' | ||
import jiti from 'jiti' | ||
|
||
export function tryImport(file: string, rootDir: string = process.cwd()) { | ||
// @ts-expect-error "This expression is not callable." but works fine | ||
const _import = jiti(rootDir, { interopDefault: true, esmResolve: true }); | ||
// @ts-expect-error "This expression is not callable." but works fine | ||
const _import = jiti(rootDir, { interopDefault: true, esmResolve: true }) | ||
|
||
try { | ||
return _import(file); | ||
} catch (error: any) { | ||
if (error.code !== "MODULE_NOT_FOUND") { | ||
console.error(`Error trying import ${file} from ${rootDir}`, error); | ||
}; | ||
return _import(file) | ||
} | ||
} | ||
catch (error: any) { | ||
if (error.code !== 'MODULE_NOT_FOUND') | ||
console.error(`Error trying import ${file} from ${rootDir}`, error) | ||
} | ||
} |