mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Produces source maps for built files.
This commit is contained in:
parent
c9d3c20e2c
commit
996805f953
3 changed files with 27 additions and 13 deletions
15
external/builder/preprocessor2.js
vendored
15
external/builder/preprocessor2.js
vendored
|
@ -347,28 +347,23 @@ function traverseTree(ctx, node) {
|
|||
}
|
||||
|
||||
function preprocessPDFJSCode(ctx, code) {
|
||||
var saveComments = !!ctx.saveComments;
|
||||
var format = ctx.format || {
|
||||
indent: {
|
||||
style: ' ',
|
||||
adjustMultilineComment: saveComments,
|
||||
}
|
||||
};
|
||||
var comments;
|
||||
var parseComment = {
|
||||
var parseOptions = {
|
||||
locations: true,
|
||||
onComments: saveComments || (comments = []),
|
||||
sourceFile: ctx.sourceFile,
|
||||
sourceType: 'module',
|
||||
};
|
||||
var codegenOptions = {
|
||||
format: format,
|
||||
comment: saveComments,
|
||||
parse: acorn.parse,
|
||||
sourceMap: ctx.sourceMap,
|
||||
sourceMapWithCode: ctx.sourceMap,
|
||||
};
|
||||
var syntax = acorn.parse(code, parseComment);
|
||||
if (saveComments) {
|
||||
escodegen.attachComments(syntax, comments);
|
||||
}
|
||||
var syntax = acorn.parse(code, parseOptions);
|
||||
traverseTree(ctx, syntax);
|
||||
return escodegen.generate(syntax, codegenOptions);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue