12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- "use strict";
- const preprocessor2 = require("../builder/preprocessor2.js");
- const path = require("path");
- module.exports = function (source) {
-
- if (!this.query || typeof this.query !== "object") {
- return source;
- }
- this.cacheable();
- const filePath = this.resourcePath;
- const context = this.rootContext;
- const sourcePath = path.relative(context, filePath).split(path.sep).join("/");
- const ctx = Object.create(this.query);
- ctx.sourceMap = true;
- ctx.sourceFile = sourcePath;
- const callback = this.callback;
- const sourceAndMap = preprocessor2.preprocessPDFJSCode(ctx, source);
- const map = sourceAndMap.map.toJSON();
-
- map.sourcesContent = [source];
- callback(null, sourceAndMap.code, map);
- return undefined;
- };
|