Skip to content

Commit

Permalink
Add source-map dependency (#1970)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviettran committed May 13, 2022
1 parent b2f33fb commit 6cdb206
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions build-tools/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function slash(path) {
return path.replace(/\\/g, '/');
}

function combineResults(fileResults, sourceMapOptions, opts) {
async function combineResults(fileResults, sourceMapOptions, opts) {
let map = null;
if (fileResults.some(result => result?.map)) {
map = new sourceMap.SourceMapGenerator(sourceMapOptions);
Expand All @@ -61,7 +61,7 @@ function combineResults(fileResults, sourceMapOptions, opts) {
code += result.code + "\n";

if (result.map) {
const consumer = new sourceMap.SourceMapConsumer(result.map);
const consumer = await new sourceMap.SourceMapConsumer(result.map);
const sources = new Set();

consumer.eachMapping(function (mapping) {
Expand Down Expand Up @@ -186,7 +186,7 @@ function compileToDir(srcDir, destDir, opts = {}) {
return total;
}

function compileToFile(srcFile, destFile, opts) {
async function compileToFile(srcFile, destFile, opts) {
const incremental = opts.incremental;
delete opts.incremental;

Expand All @@ -209,7 +209,7 @@ function compileToFile(srcFile, destFile, opts) {
if (VERBOSE) console.log(src + " ->");
}

const combined = combineResults(results, {
const combined = await combineResults(results, {
file: path.basename(destFile),
sourceRoot: opts.sourceRoot,
}, opts);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"mocha": "^6.0.2",
"preact": "^8.3.1",
"tslint": "^5.13.0",
"typescript": "^4.3.2"
"typescript": "^4.3.2",
"source-map": "^0.7.3"
},
"private": true
}

0 comments on commit 6cdb206

Please sign in to comment.