From ec1edb981e9c449ddfcbb4a86dba4c3369917249 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Thu, 9 Jan 2025 00:11:57 +0200 Subject: [PATCH] fix: register sources before the next compiler gets invoked --- src/lib/transpiler/babel.ts | 5 +---- src/lib/transpiler/coffeescript.ts | 3 +-- src/lib/transpiler/typescript.ts | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/lib/transpiler/babel.ts b/src/lib/transpiler/babel.ts index 0fd59d0..a736ce4 100644 --- a/src/lib/transpiler/babel.ts +++ b/src/lib/transpiler/babel.ts @@ -11,17 +11,14 @@ export default function babel(next: Compiler): Compiler { presets: [availablePresets.env], }); - print(res.map!.mappings); - const map = SourceMap.parse({ file: "babel-internal://" + filename, mappings: res.map!.mappings, sources: [filename], }); - const compiled = next("babel-internal://" + filename, res.code!, SourceMap.chain(map, prevMap)); registerSource(filename, code); - return compiled; + return next("babel-internal://" + filename, res.code!, SourceMap.chain(map, prevMap)); }; } diff --git a/src/lib/transpiler/coffeescript.ts b/src/lib/transpiler/coffeescript.ts index 255c856..cbf927f 100644 --- a/src/lib/transpiler/coffeescript.ts +++ b/src/lib/transpiler/coffeescript.ts @@ -20,9 +20,8 @@ export default function coffee(next: Compiler): Compiler { sources: [filename], }); - const compiled = next("coffee-internal://" + filename, result, SourceMap.chain(map, prevMap)); registerSource(filename, code); - return compiled; + return next("coffee-internal://" + filename, result, SourceMap.chain(map, prevMap)); }; } diff --git a/src/lib/transpiler/typescript.ts b/src/lib/transpiler/typescript.ts index 5ed95fd..9a76861 100644 --- a/src/lib/transpiler/typescript.ts +++ b/src/lib/transpiler/typescript.ts @@ -106,8 +106,8 @@ export default function typescript(next: Compiler): Compiler { const result = outputs["/src.js"]; const declaration = outputs["/src.d.ts"]; - const compiled = next("ts-internal://" + filename, result, SourceMap.chain(map, prevMap)); registerSource(filename, code); + const compiled = next("ts-internal://" + filename, result, SourceMap.chain(map, prevMap)); return function (this: any) { const res = compiled.apply(this, arguments);