Compare commits

...

7 commits

Author SHA1 Message Date
Princesseuh
9a2a202586
fix: don't do anything on unknown errors 2023-10-11 11:18:21 +02:00
Erika
9cee5b7c73
Merge branch 'main' into feat/tsconfck 2023-10-11 11:08:09 +02:00
Princesseuh
d707b08c48
fix: make sure package.json is in te list of watched files 2023-10-11 11:06:50 +02:00
Princesseuh
75d947de7f
test: invert logic 2023-10-10 19:34:18 +02:00
Princesseuh
50f00f480f
test: fix 2023-10-10 19:24:58 +02:00
Princesseuh
12fc88f67e
chore: changeset 2023-10-10 18:54:51 +02:00
Princesseuh
8324289453
feat: use tsconfck instead of tsconfig-resolver 2023-10-10 18:51:34 +02:00
15 changed files with 197 additions and 111 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixed `tsconfig.json`'s new array format for `extends` not working

View file

@ -167,7 +167,7 @@
"shiki": "^0.14.3", "shiki": "^0.14.3",
"string-width": "^6.1.0", "string-width": "^6.1.0",
"strip-ansi": "^7.1.0", "strip-ansi": "^7.1.0",
"tsconfig-resolver": "^3.0.1", "tsconfck": "3.0.0-next.9",
"unist-util-visit": "^4.1.2", "unist-util-visit": "^4.1.2",
"vfile": "^5.3.7", "vfile": "^5.3.7",
"vite": "^4.4.9", "vite": "^4.4.9",

View file

@ -11,13 +11,13 @@ import type * as babel from '@babel/core';
import type { OutgoingHttpHeaders } from 'node:http'; import type { OutgoingHttpHeaders } from 'node:http';
import type { AddressInfo } from 'node:net'; import type { AddressInfo } from 'node:net';
import type * as rollup from 'rollup'; import type * as rollup from 'rollup';
import type { TsConfigJson } from 'tsconfig-resolver';
import type * as vite from 'vite'; import type * as vite from 'vite';
import type { RemotePattern } from '../assets/utils/remotePattern.js'; import type { RemotePattern } from '../assets/utils/remotePattern.js';
import type { SerializedSSRManifest } from '../core/app/types.js'; import type { SerializedSSRManifest } from '../core/app/types.js';
import type { PageBuildData } from '../core/build/types.js'; import type { PageBuildData } from '../core/build/types.js';
import type { AstroConfigType } from '../core/config/index.js'; import type { AstroConfigType } from '../core/config/index.js';
import type { AstroTimer } from '../core/config/timer.js'; import type { AstroTimer } from '../core/config/timer.js';
import type { TSConfig } from '../core/config/tsconfig.js';
import type { AstroCookies } from '../core/cookies/index.js'; import type { AstroCookies } from '../core/cookies/index.js';
import type { ResponseWithEncoding } from '../core/endpoint/index.js'; import type { ResponseWithEncoding } from '../core/endpoint/index.js';
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js'; import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
@ -1503,7 +1503,7 @@ export interface AstroSettings {
* Map of directive name (e.g. `load`) to the directive script code * Map of directive name (e.g. `load`) to the directive script code
*/ */
clientDirectives: Map<string, string>; clientDirectives: Map<string, string>;
tsConfig: TsConfigJson | undefined; tsConfig: TSConfig | undefined;
tsConfigPath: string | undefined; tsConfigPath: string | undefined;
watchFiles: string[]; watchFiles: string[];
timer: AstroTimer; timer: AstroTimer;

View file

@ -848,25 +848,31 @@ async function updateTSConfig(
return UpdateResult.none; return UpdateResult.none;
} }
const inputConfig = loadTSConfig(cwd, false); let inputConfig = await loadTSConfig(cwd);
const configFileName = inputConfig.exists ? inputConfig.path.split('/').pop() : 'tsconfig.json'; let inputConfigText = '';
if (inputConfig.reason === 'invalid-config') { if (inputConfig === 'invalid-config' || inputConfig === 'unknown-error') {
return UpdateResult.failure; return UpdateResult.failure;
} else if (inputConfig === 'missing-config') {
logger.debug('add', "Couldn't find tsconfig.json or jsconfig.json, generating one");
inputConfig = {
tsconfig: defaultTSConfig,
tsconfigFile: path.join(cwd, 'tsconfig.json'),
rawConfig: { tsconfig: defaultTSConfig, tsconfigFile: path.join(cwd, 'tsconfig.json') },
};
} else {
inputConfigText = JSON.stringify(inputConfig.rawConfig.tsconfig, null, 2);
} }
if (inputConfig.reason === 'not-found') { const configFileName = inputConfig.tsconfigFile.split('/').pop();
logger.debug('add', "Couldn't find tsconfig.json or jsconfig.json, generating one");
}
const outputConfig = updateTSConfigForFramework( const outputConfig = updateTSConfigForFramework(
inputConfig.exists ? inputConfig.config : defaultTSConfig, inputConfig.rawConfig.tsconfig,
firstIntegrationWithTSSettings firstIntegrationWithTSSettings
); );
const input = inputConfig.exists ? JSON.stringify(inputConfig.config, null, 2) : '';
const output = JSON.stringify(outputConfig, null, 2); const output = JSON.stringify(outputConfig, null, 2);
const diff = getDiffContent(input, output); const diff = getDiffContent(inputConfigText, output);
if (!diff) { if (!diff) {
return UpdateResult.none; return UpdateResult.none;
@ -906,7 +912,7 @@ async function updateTSConfig(
} }
if (await askToContinue({ flags })) { if (await askToContinue({ flags })) {
await fs.writeFile(inputConfig?.path ?? path.join(cwd, 'tsconfig.json'), output, { await fs.writeFile(inputConfig.tsconfigFile, output, {
encoding: 'utf-8', encoding: 'utf-8',
}); });
logger.debug('add', `Updated ${configFileName} file`); logger.debug('add', `Updated ${configFileName} file`);

View file

@ -35,7 +35,7 @@ export function getViteConfig(inlineConfig: UserConfig) {
level: 'info', level: 'info',
}); });
const { astroConfig: config } = await resolveConfig({}, cmd); const { astroConfig: config } = await resolveConfig({}, cmd);
const settings = createSettings(config, inlineConfig.root); const settings = await createSettings(config, inlineConfig.root);
await runHookConfigSetup({ settings, command: cmd, logger }); await runHookConfigSetup({ settings, command: cmd, logger });
const viteConfig = await createVite( const viteConfig = await createVite(
{ {

View file

@ -32,7 +32,7 @@ export async function attachContentServerListeners({
contentPaths.contentDir.href.replace(settings.config.root.href, '') contentPaths.contentDir.href.replace(settings.config.root.href, '')
)} for changes` )} for changes`
); );
const maybeTsConfigStats = getTSConfigStatsWhenAllowJsFalse({ contentPaths, settings }); const maybeTsConfigStats = await getTSConfigStatsWhenAllowJsFalse({ contentPaths, settings });
if (maybeTsConfigStats) warnAllowJsIsFalse({ ...maybeTsConfigStats, logger }); if (maybeTsConfigStats) warnAllowJsIsFalse({ ...maybeTsConfigStats, logger });
await attachListeners(); await attachListeners();
} else { } else {
@ -96,7 +96,7 @@ See ${bold('https://www.typescriptlang.org/tsconfig#allowJs')} for more informat
); );
} }
function getTSConfigStatsWhenAllowJsFalse({ async function getTSConfigStatsWhenAllowJsFalse({
contentPaths, contentPaths,
settings, settings,
}: { }: {
@ -108,15 +108,15 @@ function getTSConfigStatsWhenAllowJsFalse({
); );
if (!isContentConfigJsFile) return; if (!isContentConfigJsFile) return;
const inputConfig = loadTSConfig(fileURLToPath(settings.config.root), false); const inputConfig = await loadTSConfig(fileURLToPath(settings.config.root));
const tsConfigFileName = inputConfig.exists && inputConfig.path.split(path.sep).pop(); if (typeof inputConfig === 'string') return;
const tsConfigFileName = inputConfig.tsconfigFile.split(path.sep).pop();
if (!tsConfigFileName) return; if (!tsConfigFileName) return;
const contentConfigFileName = contentPaths.config.url.pathname.split(path.sep).pop()!; const contentConfigFileName = contentPaths.config.url.pathname.split(path.sep).pop()!;
const allowJSOption = inputConfig?.config?.compilerOptions?.allowJs; const allowJSOption = inputConfig.tsconfig.compilerOptions?.allowJs;
const hasAllowJs = if (allowJSOption) return;
allowJSOption === true || (tsConfigFileName === 'jsconfig.json' && allowJSOption !== false);
if (hasAllowJs) return;
return { tsConfigFileName, contentConfigFileName }; return { tsConfigFileName, contentConfigFileName };
} }

View file

@ -59,7 +59,7 @@ export default async function build(
const { userConfig, astroConfig } = await resolveConfig(inlineConfig, 'build'); const { userConfig, astroConfig } = await resolveConfig(inlineConfig, 'build');
telemetry.record(eventCliSession('build', userConfig)); telemetry.record(eventCliSession('build', userConfig));
const settings = createSettings(astroConfig, fileURLToPath(astroConfig.root)); const settings = await createSettings(astroConfig, fileURLToPath(astroConfig.root));
const builder = new AstroBuilder(settings, { const builder = new AstroBuilder(settings, {
...options, ...options,

View file

@ -102,18 +102,24 @@ export function createBaseSettings(config: AstroConfig): AstroSettings {
}; };
} }
export function createSettings(config: AstroConfig, cwd?: string): AstroSettings { export async function createSettings(config: AstroConfig, cwd?: string): Promise<AstroSettings> {
const tsconfig = loadTSConfig(cwd); const tsconfig = await loadTSConfig(cwd);
const settings = createBaseSettings(config); const settings = createBaseSettings(config);
const watchFiles = tsconfig?.exists ? [tsconfig.path, ...tsconfig.extendedPaths] : []; let watchFiles = [];
if (cwd) { if (cwd) {
watchFiles.push(fileURLToPath(new URL('./package.json', pathToFileURL(cwd)))); watchFiles.push(fileURLToPath(new URL('./package.json', pathToFileURL(cwd))));
} }
settings.tsConfig = tsconfig?.config; if (typeof tsconfig !== 'string') {
settings.tsConfigPath = tsconfig?.path; watchFiles.push(
...[tsconfig.tsconfigFile, ...(tsconfig.extended ?? []).map((e) => e.tsconfigFile)]
);
settings.tsConfig = tsconfig.tsconfig;
settings.tsConfigPath = tsconfig.tsconfigFile;
}
settings.watchFiles = watchFiles; settings.watchFiles = watchFiles;
return settings; return settings;
} }

View file

@ -1,13 +1,19 @@
import { existsSync } from 'node:fs';
import { join } from 'node:path'; import { join } from 'node:path';
import * as tsr from 'tsconfig-resolver'; import {
TSConfckParseError,
find,
parse,
type TSConfckParseOptions,
type TSConfckParseResult,
} from 'tsconfck';
import type { CompilerOptions, TypeAcquisition } from 'typescript';
export const defaultTSConfig: tsr.TsConfigJson = { extends: 'astro/tsconfigs/base' }; export const defaultTSConfig: TSConfig = { extends: 'astro/tsconfigs/base' };
export type frameworkWithTSSettings = 'vue' | 'react' | 'preact' | 'solid-js'; export type frameworkWithTSSettings = 'vue' | 'react' | 'preact' | 'solid-js';
// The following presets unfortunately cannot be inside the specific integrations, as we need // The following presets unfortunately cannot be inside the specific integrations, as we need
// them even in cases where the integrations are not installed // them even in cases where the integrations are not installed
export const presets = new Map<frameworkWithTSSettings, tsr.TsConfigJson>([ export const presets = new Map<frameworkWithTSSettings, TSConfig>([
[ [
'vue', // Settings needed for template intellisense when using Volar 'vue', // Settings needed for template intellisense when using Volar
{ {
@ -45,52 +51,78 @@ export const presets = new Map<frameworkWithTSSettings, tsr.TsConfigJson>([
], ],
]); ]);
// eslint-disable-next-line @typescript-eslint/ban-types
type TSConfigResult<T = {}> = Promise<
(TSConfckParseResult & T) | 'invalid-config' | 'missing-config' | 'unknown-error'
>;
/** /**
* Load a tsconfig.json or jsconfig.json is the former is not found * Load a tsconfig.json or jsconfig.json is the former is not found
* @param cwd Directory to start from * @param root The root directory to search in, defaults to `process.cwd()`.
* @param resolve Determine if the function should go up directories like TypeScript would * @param findUp Whether to search for the config file in parent directories, by default only the root directory is searched.
*/ */
export function loadTSConfig(cwd: string | undefined, resolve = true): tsr.TsConfigResult { export async function loadTSConfig(
cwd = cwd ?? process.cwd(); root: string | undefined,
let config = tsr.tsconfigResolverSync({ findUp = false
cwd, ): Promise<TSConfigResult<{ rawConfig: TSConfckParseResult }>> {
filePath: resolve ? undefined : cwd, const safeCwd = root ?? process.cwd();
ignoreExtends: !resolve,
});
// When a direct filepath is provided to `tsconfigResolver`, it'll instead return invalid-config even when const [jsconfig, tsconfig] = await Promise.all(
// the file does not exists. We'll manually handle this so we can provide better errors to users ['jsconfig.json', 'tsconfig.json'].map((configName) =>
if (!resolve && config.reason === 'invalid-config' && !existsSync(join(cwd, 'tsconfig.json'))) { // `tsconfck` expects its first argument to be a file path, not a directory path, so we'll fake one
config = { reason: 'not-found', path: undefined, exists: false }; find(join(safeCwd, './dummy.txt'), {
} root: findUp ? undefined : root,
configName: configName,
})
)
);
// If we couldn't find a tsconfig.json, try to load a jsconfig.json instead // If we have both files, prefer tsconfig.json
if (config.reason === 'not-found') { if (tsconfig) {
const jsconfig = tsr.tsconfigResolverSync({ const parsedConfig = await safeParse(tsconfig, { root: root });
cwd,
filePath: resolve ? undefined : cwd,
searchName: 'jsconfig.json',
ignoreExtends: !resolve,
});
if ( if (typeof parsedConfig === 'string') {
!resolve && return parsedConfig;
jsconfig.reason === 'invalid-config' &&
!existsSync(join(cwd, 'jsconfig.json'))
) {
return { reason: 'not-found', path: undefined, exists: false };
} }
return jsconfig; return { ...parsedConfig, rawConfig: parsedConfig.extended?.[0] ?? parsedConfig.tsconfig };
} }
return config; if (jsconfig) {
const parsedConfig = await safeParse(jsconfig, { root: root });
if (typeof parsedConfig === 'string') {
return parsedConfig;
}
return { ...parsedConfig, rawConfig: parsedConfig.extended?.[0] ?? parsedConfig.tsconfig };
}
return 'missing-config';
}
async function safeParse(tsconfigPath: string, options: TSConfckParseOptions = {}): TSConfigResult {
try {
const parseResult = await parse(tsconfigPath, options);
if (parseResult.tsconfig == null) {
return 'missing-config';
}
return parseResult;
} catch (e) {
if (e instanceof TSConfckParseError) {
return 'invalid-config';
}
return 'unknown-error';
}
} }
export function updateTSConfigForFramework( export function updateTSConfigForFramework(
target: tsr.TsConfigJson, target: TSConfig,
framework: frameworkWithTSSettings framework: frameworkWithTSSettings
): tsr.TsConfigJson { ): TSConfig {
if (!presets.has(framework)) { if (!presets.has(framework)) {
return target; return target;
} }
@ -120,3 +152,32 @@ function deepMergeObjects<T extends Record<string, any>>(a: T, b: T): T {
return merged; return merged;
} }
// The code below is adapted from `pkg-types`
// `pkg-types` offer more types and utilities, but since we only want the TSConfig type, we'd rather avoid adding a dependency.
// https://github.com/unjs/pkg-types/blob/78328837d369d0145a8ddb35d7fe1fadda4bfadf/src/types/tsconfig.ts
// See https://github.com/unjs/pkg-types/blob/78328837d369d0145a8ddb35d7fe1fadda4bfadf/LICENSE for license information
export type StripEnums<T extends Record<string, any>> = {
[K in keyof T]: T[K] extends boolean
? T[K]
: T[K] extends string
? T[K]
: T[K] extends object
? T[K]
: T[K] extends Array<any>
? T[K]
: T[K] extends undefined
? undefined
: any;
};
export interface TSConfig {
compilerOptions?: StripEnums<CompilerOptions>;
compileOnSave?: boolean;
extends?: string;
files?: string[];
include?: string[];
exclude?: string[];
typeAcquisition?: TypeAcquisition;
}

View file

@ -64,7 +64,7 @@ export async function restartContainer(container: Container): Promise<Container
try { try {
const { astroConfig } = await resolveConfig(container.inlineConfig, 'dev', container.fs); const { astroConfig } = await resolveConfig(container.inlineConfig, 'dev', container.fs);
const settings = createSettings(astroConfig, fileURLToPath(existingSettings.config.root)); const settings = await createSettings(astroConfig, fileURLToPath(existingSettings.config.root));
await close(); await close();
return await createRestartedContainer(container, settings); return await createRestartedContainer(container, settings);
} catch (_err) { } catch (_err) {
@ -105,7 +105,7 @@ export async function createContainerWithAutomaticRestart({
const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, 'dev', fs); const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, 'dev', fs);
telemetry.record(eventCliSession('dev', userConfig)); telemetry.record(eventCliSession('dev', userConfig));
const settings = createSettings(astroConfig, fileURLToPath(astroConfig.root)); const settings = await createSettings(astroConfig, fileURLToPath(astroConfig.root));
const initialContainer = await createContainer({ settings, logger: logger, inlineConfig, fs }); const initialContainer = await createContainer({ settings, logger: logger, inlineConfig, fs });

View file

@ -22,7 +22,7 @@ export default async function preview(inlineConfig: AstroInlineConfig): Promise<
const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, 'preview'); const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, 'preview');
telemetry.record(eventCliSession('preview', userConfig)); telemetry.record(eventCliSession('preview', userConfig));
const _settings = createSettings(astroConfig, fileURLToPath(astroConfig.root)); const _settings = await createSettings(astroConfig, fileURLToPath(astroConfig.root));
const settings = await runHookConfigSetup({ const settings = await runHookConfigSetup({
settings: _settings, settings: _settings,

View file

@ -45,7 +45,7 @@ export default async function sync(
const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, 'sync'); const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, 'sync');
telemetry.record(eventCliSession('sync', userConfig)); telemetry.record(eventCliSession('sync', userConfig));
const _settings = createSettings(astroConfig, fileURLToPath(astroConfig.root)); const _settings = await createSettings(astroConfig, fileURLToPath(astroConfig.root));
const settings = await runHookConfigSetup({ const settings = await runHookConfigSetup({
settings: _settings, settings: _settings,

View file

@ -1,4 +1,5 @@
import path from 'node:path'; import path from 'node:path';
import type { CompilerOptions } from 'typescript';
import { normalizePath, type ResolvedConfig, type Plugin as VitePlugin } from 'vite'; import { normalizePath, type ResolvedConfig, type Plugin as VitePlugin } from 'vite';
import type { AstroSettings } from '../@types/astro.js'; import type { AstroSettings } from '../@types/astro.js';
@ -12,7 +13,7 @@ const getConfigAlias = (settings: AstroSettings): Alias[] | null => {
const { tsConfig, tsConfigPath } = settings; const { tsConfig, tsConfigPath } = settings;
if (!tsConfig || !tsConfigPath || !tsConfig.compilerOptions) return null; if (!tsConfig || !tsConfigPath || !tsConfig.compilerOptions) return null;
const { baseUrl, paths } = tsConfig.compilerOptions; const { baseUrl, paths } = tsConfig.compilerOptions as CompilerOptions;
if (!baseUrl) return null; if (!baseUrl) return null;
// resolve the base url from the configuration file directory // resolve the base url from the configuration file directory

View file

@ -1,68 +1,57 @@
import { expect } from 'chai'; import { expect } from 'chai';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { loadTSConfig, updateTSConfigForFramework } from '../../../dist/core/config/index.js'; import { loadTSConfig, updateTSConfigForFramework } from '../../../dist/core/config/index.js';
import * as path from 'node:path';
import * as tsr from 'tsconfig-resolver';
const cwd = fileURLToPath(new URL('../../fixtures/tsconfig-handling/', import.meta.url)); const cwd = fileURLToPath(new URL('../../fixtures/tsconfig-handling/', import.meta.url));
describe('TSConfig handling', () => { describe('TSConfig handling', () => {
beforeEach(() => {
// `tsconfig-resolver` has a weird internal cache that only vaguely respect its own rules when not resolving
// so we need to clear it before each test or we'll get false positives. This should only be relevant in tests.
tsr.clearCache();
});
describe('tsconfig / jsconfig loading', () => { describe('tsconfig / jsconfig loading', () => {
it('can load tsconfig.json', () => { it('can load tsconfig.json', async () => {
const config = loadTSConfig(cwd); const config = await loadTSConfig(cwd);
expect(config.exists).to.equal(true); expect(config).to.not.be.undefined;
expect(config.config.files).to.deep.equal(['im-a-test']);
}); });
it('can resolve tsconfig.json up directories', () => { it('can resolve tsconfig.json up directories', async () => {
const config = loadTSConfig(path.join(cwd, 'nested-folder')); const config = await loadTSConfig(cwd);
expect(config.exists).to.equal(true); expect(config).to.not.be.undefined;
expect(config.path).to.equal(path.join(cwd, 'tsconfig.json')); expect(config.tsconfigFile).to.equal(path.join(cwd, 'tsconfig.json'));
expect(config.config.files).to.deep.equal(['im-a-test']); expect(config.tsconfig.files).to.deep.equal(['im-a-test']);
}); });
it('can fallback to jsconfig.json if tsconfig.json does not exists', () => { it('can fallback to jsconfig.json if tsconfig.json does not exists', async () => {
const config = loadTSConfig(path.join(cwd, 'jsconfig'), false); const config = await loadTSConfig(path.join(cwd, 'jsconfig'));
expect(config.exists).to.equal(true); expect(config).to.not.be.undefined;
expect(config.path).to.equal(path.join(cwd, 'jsconfig', 'jsconfig.json')); expect(config.tsconfigFile).to.equal(path.join(cwd, 'jsconfig', 'jsconfig.json'));
expect(config.config.files).to.deep.equal(['im-a-test-js']); expect(config.tsconfig.files).to.deep.equal(['im-a-test-js']);
}); });
it('properly return errors when not resolving', () => { it('properly return errors when not resolving', async () => {
const invalidConfig = loadTSConfig(path.join(cwd, 'invalid'), false); const invalidConfig = await loadTSConfig(path.join(cwd, 'invalid'));
const missingConfig = loadTSConfig(path.join(cwd, 'missing'), false); const missingConfig = await loadTSConfig(path.join(cwd, 'missing'));
expect(invalidConfig.exists).to.equal(false); expect(invalidConfig).to.equal('invalid-config');
expect(invalidConfig.reason).to.equal('invalid-config'); expect(missingConfig).to.equal('missing-config');
expect(missingConfig.exists).to.equal(false);
expect(missingConfig.reason).to.equal('not-found');
}); });
}); });
describe('tsconfig / jsconfig updates', () => { describe('tsconfig / jsconfig updates', () => {
it('can update a tsconfig with a framework config', () => { it('can update a tsconfig with a framework config', async () => {
const config = loadTSConfig(cwd); const config = await loadTSConfig(cwd);
const updatedConfig = updateTSConfigForFramework(config.config, 'react'); const updatedConfig = updateTSConfigForFramework(config.tsconfig, 'react');
expect(config.config).to.not.equal('react-jsx'); expect(config.tsconfig).to.not.equal('react-jsx');
expect(updatedConfig.compilerOptions.jsx).to.equal('react-jsx'); expect(updatedConfig.compilerOptions.jsx).to.equal('react-jsx');
}); });
it('produce no changes on invalid frameworks', () => { it('produce no changes on invalid frameworks', async () => {
const config = loadTSConfig(cwd); const config = await loadTSConfig(cwd);
const updatedConfig = updateTSConfigForFramework(config.config, 'doesnt-exist'); const updatedConfig = updateTSConfigForFramework(config.tsconfig, 'doesnt-exist');
expect(config.config).to.deep.equal(updatedConfig); expect(config.tsconfig).to.deep.equal(updatedConfig);
}); });
}); });
}); });

View file

@ -625,9 +625,9 @@ importers:
strip-ansi: strip-ansi:
specifier: ^7.1.0 specifier: ^7.1.0
version: 7.1.0 version: 7.1.0
tsconfig-resolver: tsconfck:
specifier: ^3.0.1 specifier: 3.0.0-next.9
version: 3.0.1 version: 3.0.0-next.9(typescript@5.1.6)
unist-util-visit: unist-util-visit:
specifier: ^4.1.2 specifier: ^4.1.2
version: 4.1.2 version: 4.1.2
@ -8834,6 +8834,7 @@ packages:
/@types/json5@0.0.30: /@types/json5@0.0.30:
resolution: {integrity: sha512-sqm9g7mHlPY/43fcSNrCYfOeX9zkTTK+euO5E6+CVijSMm5tTjkVdwdqRkY3ljjIAf8679vps5jKUoJBCLsMDA==} resolution: {integrity: sha512-sqm9g7mHlPY/43fcSNrCYfOeX9zkTTK+euO5E6+CVijSMm5tTjkVdwdqRkY3ljjIAf8679vps5jKUoJBCLsMDA==}
dev: true
/@types/katex@0.16.0: /@types/katex@0.16.0:
resolution: {integrity: sha512-hz+S3nV6Mym5xPbT9fnO8dDhBFQguMYpY0Ipxv06JMi1ORgnEM4M1ymWDUhUNer3ElLmT583opRo4RzxKmh9jw==} resolution: {integrity: sha512-hz+S3nV6Mym5xPbT9fnO8dDhBFQguMYpY0Ipxv06JMi1ORgnEM4M1ymWDUhUNer3ElLmT583opRo4RzxKmh9jw==}
@ -8983,6 +8984,7 @@ packages:
/@types/resolve@1.20.2: /@types/resolve@1.20.2:
resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
dev: true
/@types/sax@1.2.4: /@types/sax@1.2.4:
resolution: {integrity: sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==} resolution: {integrity: sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==}
@ -16595,6 +16597,7 @@ packages:
/strip-bom@4.0.0: /strip-bom@4.0.0:
resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==}
engines: {node: '>=8'} engines: {node: '>=8'}
dev: true
/strip-comments@2.0.1: /strip-comments@2.0.1:
resolution: {integrity: sha512-ZprKx+bBLXv067WTCALv8SSz5l2+XhpYCsVtSqlMnkAXMWDq+/ekVbl1ghqP9rUHTzv6sm/DwCOiYutU/yp1fw==} resolution: {integrity: sha512-ZprKx+bBLXv067WTCALv8SSz5l2+XhpYCsVtSqlMnkAXMWDq+/ekVbl1ghqP9rUHTzv6sm/DwCOiYutU/yp1fw==}
@ -17017,6 +17020,19 @@ packages:
code-block-writer: 12.0.0 code-block-writer: 12.0.0
dev: true dev: true
/tsconfck@3.0.0-next.9(typescript@5.1.6):
resolution: {integrity: sha512-bgVlu3qcRUZpm9Au1IHiPDkb8XU+72bRkXrBaJsiAjIlixtkbKLe4q1odrrqG0rVHvh0Q4R3adT/nh1FwzftXA==}
engines: {node: ^18 || >=20}
hasBin: true
peerDependencies:
typescript: ^5.0.0
peerDependenciesMeta:
typescript:
optional: true
dependencies:
typescript: 5.1.6
dev: false
/tsconfig-resolver@3.0.1: /tsconfig-resolver@3.0.1:
resolution: {integrity: sha512-ZHqlstlQF449v8glscGRXzL6l2dZvASPCdXJRWG4gHEZlUVx2Jtmr+a2zeVG4LCsKhDXKRj5R3h0C/98UcVAQg==} resolution: {integrity: sha512-ZHqlstlQF449v8glscGRXzL6l2dZvASPCdXJRWG4gHEZlUVx2Jtmr+a2zeVG4LCsKhDXKRj5R3h0C/98UcVAQg==}
dependencies: dependencies:
@ -17026,6 +17042,7 @@ packages:
resolve: 1.22.4 resolve: 1.22.4
strip-bom: 4.0.0 strip-bom: 4.0.0
type-fest: 3.0.0 type-fest: 3.0.0
dev: true
/tsconfig@7.0.0: /tsconfig@7.0.0:
resolution: {integrity: sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw==} resolution: {integrity: sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw==}
@ -17176,6 +17193,7 @@ packages:
/type-fest@3.0.0: /type-fest@3.0.0:
resolution: {integrity: sha512-MINvUN5ug9u+0hJDzSZNSnuKXI8M4F5Yvb6SQZ2CYqe7SgKXKOosEcU5R7tRgo85I6eAVBbkVF7TCvB4AUK2xQ==} resolution: {integrity: sha512-MINvUN5ug9u+0hJDzSZNSnuKXI8M4F5Yvb6SQZ2CYqe7SgKXKOosEcU5R7tRgo85I6eAVBbkVF7TCvB4AUK2xQ==}
engines: {node: '>=14.16'} engines: {node: '>=14.16'}
dev: true
/type-is@1.6.18: /type-is@1.6.18:
resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}