Skip to content

Commit

Permalink
fix(tsc): remove exit early condition
Browse files Browse the repository at this point in the history
close #4231
  • Loading branch information
johnsoncodehk committed Apr 10, 2024
1 parent 32b7c72 commit f2789d9
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions packages/tsc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,7 @@ export function run() {
) {
const writeFile = options.host!.writeFile.bind(options.host);
options.host!.writeFile = (fileName, contents, ...args) => {
if (
fileName.endsWith('.d.ts')
&& vueLanguagePlugin
.getCanonicalFileName(fileName.replace(windowsPathReg, '/'))
.slice(0, -5) === vueLanguagePlugin.pluginContext.globalTypesHolder
) {
contents = removeEmitGlobalTypes(contents);
}
contents = removeEmitGlobalTypes(contents);
return writeFile(fileName, contents, ...args);
};
const vueLanguagePlugin = vue.createVueLanguagePlugin(
Expand Down Expand Up @@ -66,6 +59,8 @@ export function run() {
}
}

const removeEmitGlobalTypesRegexp = /[^\n]*__VLS_globalTypesStart[\w\W]*__VLS_globalTypesEnd[^\n]*\n/g;

export function removeEmitGlobalTypes(dts: string) {
return dts.replace(/[^\n]*__VLS_globalTypesStart[\w\W]*__VLS_globalTypesEnd[^\n]*\n/, '');
return dts.replace(removeEmitGlobalTypesRegexp, '');
}

0 comments on commit f2789d9

Please sign in to comment.