tweak transpile and pasteUrl.test

This commit is contained in:
Johannes
2024-10-02 10:30:35 +02:00
parent 90fad18259
commit c4093a5112
3 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -253,6 +253,7 @@ class ESBuildTranspiler {
target: ['es2022'],
format: this._cmdLine.options.module === ts.ModuleKind.CommonJS ? 'cjs' : 'esm',
loader: 'ts',
sourcemap: 'inline',
tsconfigRaw: JSON.stringify({
compilerOptions: this._cmdLine.options
}),
@@ -262,7 +263,7 @@ class ESBuildTranspiler {
}).then(result => {
// check if output of a DTS-files isn't just "empty" and iff so
// skip this file
if (file.path.endsWith('.d.ts') && _isDefaultEmpty(result.code)) {
if (file.path.endsWith('.d.ts') || _isDefaultEmpty(result.code)) {
return;
}
const outBase = this._cmdLine.options.outDir ?? file.base;
@@ -282,6 +283,7 @@ exports.ESBuildTranspiler = ESBuildTranspiler;
function _isDefaultEmpty(src) {
return src
.replace('"use strict";', '')
.replace(/\/\/# sourceMappingURL.*^/, '')
.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1')
.trim().length === 0;
}
+3 -1
View File
@@ -324,6 +324,7 @@ export class ESBuildTranspiler implements ITranspiler {
target: ['es2022'],
format: this._cmdLine.options.module === ts.ModuleKind.CommonJS ? 'cjs' : 'esm',
loader: 'ts',
sourcemap: 'inline',
tsconfigRaw: JSON.stringify({
compilerOptions: this._cmdLine.options
}),
@@ -334,7 +335,7 @@ export class ESBuildTranspiler implements ITranspiler {
// check if output of a DTS-files isn't just "empty" and iff so
// skip this file
if (file.path.endsWith('.d.ts') && _isDefaultEmpty(result.code)) {
if (file.path.endsWith('.d.ts') || _isDefaultEmpty(result.code)) {
return;
}
@@ -358,6 +359,7 @@ export class ESBuildTranspiler implements ITranspiler {
function _isDefaultEmpty(src: string): boolean {
return src
.replace('"use strict";', '')
.replace(/\/\/# sourceMappingURL.*^/, '')
.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1')
.trim().length === 0;
}
@@ -181,7 +181,7 @@ suite('createEditAddingLinksForUriList', () => {
});
test('Smart should be disabled in math blocks', async () => {
const katex = (await import('@vscode/markdown-it-katex')).default;
const katex = (<any>(await import('@vscode/markdown-it-katex')).default).default;
const engine = createNewMarkdownEngine();
(await engine.getEngine(undefined)).use(katex);
assert.strictEqual(