Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #174: support TypeScript v5.7 #175

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion projects/core/src/actions/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import path from 'path';
import { getInstallerOptions, InstallerOptions } from '../options';
import { writeFileWithLock } from '../utils';
import { getPatchedSource } from '../patch/get-patched-source';
import { existsSync } from 'fs';


/* ****************************************************************************************************************** */
Expand All @@ -29,7 +30,10 @@ export function patch(moduleNameOrNames: string | string[], opts?: Partial<Insta

/* Get modules to patch and patch info */
const moduleFiles: [ string, ModuleFile ][] =
targetModuleNames.map(m => [ m, getModuleFile(tsPackage.getModulePath(m)) ]);
targetModuleNames
.filter(m => existsSync(tsPackage.getModulePath(m)))
.map(m => [ m, getModuleFile(tsPackage.getModulePath(m)) ]);
if (!moduleFiles.length) throw new PatchError(`No valid modules found to patch`);

/* Determine files not already patched or outdated */
const patchableFiles = moduleFiles.filter(entry => {
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const defaultNodePrinterOptions: ts.PrinterOptions = {
// region: Patch Config
/* ****************************************************************************************************************** */

export const defaultInstallLibraries = [ 'tsc.js', 'typescript.js' ];
export const defaultInstallLibraries = [ 'tsc.js', 'typescript.js', '_tsc.js' ];

export const corePatchName = `<core>`;

Expand Down
9 changes: 8 additions & 1 deletion projects/core/src/module/ts-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ import { cachedFilePatchedPrefix } from '../config';
/* ****************************************************************************************************************** */

export namespace TsModule {
export const names = <const>['tsc.js', 'tsserverlibrary.js', 'typescript.js', 'tsserver.js'];
export const names = <const>[
'tsc.js',
'tsserverlibrary.js',
'typescript.js',
'tsserver.js',
'_tsc.js',
'_tsserver.js',
];
}

// endregion
Expand Down
2 changes: 1 addition & 1 deletion projects/patch/src/ts/create-program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace tsp {
const pluginCreator = new PluginCreator(plugins, { resolveBaseDir: projectConfig.projectDir ?? process.cwd() });

/* Handle JSDoc parsing in v5.3+ */
if (tsp.currentLibrary === 'tsc' && tsShim.JSDocParsingMode && pluginCreator.needsTscJsDocParsing) {
if ((tsp.currentLibrary === 'tsc' || tsp.currentLibrary === '_tsc') && tsShim.JSDocParsingMode && pluginCreator.needsTscJsDocParsing) {
host!.jsDocParsingMode = tsShim.JSDocParsingMode.ParseAll;
}

Expand Down
Loading