[ci] format
This commit is contained in:
parent
fc885eaea1
commit
c7c3cf7104
3 changed files with 6 additions and 9 deletions
|
@ -554,16 +554,14 @@ async function tryLoadConfig(
|
|||
}
|
||||
}
|
||||
|
||||
function loadTSConfig(
|
||||
cwd: string | undefined
|
||||
): tsr.TsConfigResult | undefined {
|
||||
for(const searchName of ['tsconfig.json', 'jsconfig.json']) {
|
||||
function loadTSConfig(cwd: string | undefined): tsr.TsConfigResult | undefined {
|
||||
for (const searchName of ['tsconfig.json', 'jsconfig.json']) {
|
||||
const config = tsr.tsconfigResolverSync({ cwd, searchName });
|
||||
if(config.exists) {
|
||||
if (config.exists) {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,6 @@ export declare interface Alias {
|
|||
/** Returns a path with its slashes replaced with posix slashes. */
|
||||
const normalize = (pathname: string) => String(pathname).split(path.sep).join(path.posix.sep);
|
||||
|
||||
|
||||
/** Returns a list of compiled aliases. */
|
||||
const getConfigAlias = (astroConfig: AstroConfig): Alias[] | null => {
|
||||
/** Closest tsconfig.json or jsconfig.json */
|
||||
|
|
|
@ -16,7 +16,7 @@ import tagExportsPlugin from './tag.js';
|
|||
|
||||
type FixedCompilerOptions = TsConfigJson.CompilerOptions & {
|
||||
jsxImportSource?: string;
|
||||
}
|
||||
};
|
||||
|
||||
const JSX_EXTENSIONS = new Set(['.jsx', '.tsx', '.mdx']);
|
||||
const IMPORT_STATEMENTS: Record<string, string> = {
|
||||
|
@ -229,7 +229,7 @@ export default function jsx({ config, logging }: AstroPluginJSXOptions): Plugin
|
|||
}
|
||||
|
||||
// Check the tsconfig
|
||||
if(!importSource) {
|
||||
if (!importSource) {
|
||||
const compilerOptions = config._ctx.tsConfig?.compilerOptions;
|
||||
importSource = (compilerOptions as FixedCompilerOptions | undefined)?.jsxImportSource;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue