1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
Description: Fix source-map type incompatibilities with version 0.6.x
Debian ships source-map 0.6.1 but ts-loader expects 0.7.x.
The API differences:
- destroy() doesn't exist in 0.6.x (use optional chaining)
- RawSourceMap.version is string in 0.6.x, number in 0.7.x
- Types don't declare toJSON() but it exists at runtime
Author: Yadd <yadd@debian.org>
Forwarded: not-needed
Last-Update: 2026-03-17
--- a/src/index.ts
+++ b/src/index.ts
@@ -155,8 +155,10 @@
}
// otherwise we have to make a mapping to the input source map which is asynchronous
+ // @ts-ignore source-map 0.6.x vs 0.7.x type incompatibility
mapToInputSourceMap(sourceMap, loaderContext, inputSourceMap as RawSourceMap)
.then(mappedSourceMap => {
+ // @ts-ignore source-map 0.6.x vs 0.7.x type incompatibility
callback(null, output, mappedSourceMap);
})
.catch((e: Error) => {
@@ -722,17 +724,20 @@
sourceMapConsumers[1]
);
generator.applySourceMap(sourceMapConsumers[0]);
+ // @ts-ignore toJSON exists in source-map 0.6.x despite types
const mappedSourceMap = generator.toJSON();
// before resolving, we free memory by calling destroy on the source map consumers
sourceMapConsumers.forEach(sourceMapConsumer =>
- sourceMapConsumer.destroy()
+ // @ts-ignore destroy doesn't exist in source-map 0.6.x
+ sourceMapConsumer.destroy?.()
);
resolve(mappedSourceMap);
} catch (e) {
//before rejecting, we free memory by calling destroy on the source map consumers
sourceMapConsumers.forEach(sourceMapConsumer =>
- sourceMapConsumer.destroy()
+ // @ts-ignore destroy doesn't exist in source-map 0.6.x
+ sourceMapConsumer.destroy?.()
);
reject(e);
}
|