Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source-map dependency #1970

Merged
merged 1 commit into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
}