From 715b8aa3898abb550b3df361c303cebdca87e5a1 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 4 Dec 2020 12:34:09 +0100 Subject: [PATCH] Move, and rename, the `src/scripting_api/quickjs-sandbox.js` file to `src/pdf.sandbox.js` The current location feels somewhat strange, and also inconsistent with the existing way that bundling is done. Finally, add the version/build numbers at the top of the *built* `pdf.sandbox.js` files, since all other built files include that information given that it's often helpful to be able to easily determine the *exact* version. --- gulpfile.js | 3 ++- src/{scripting_api/quickjs-sandbox.js => pdf.sandbox.js} | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) rename src/{scripting_api/quickjs-sandbox.js => pdf.sandbox.js} (91%) diff --git a/gulpfile.js b/gulpfile.js index 8e95a5257..b1bf1e5d3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -349,6 +349,7 @@ function createScriptingBundle(defines) { function createSandboxBundle(defines, code) { var sandboxAMDName = "pdfjs-dist/build/pdf.sandbox"; var sandboxOutputName = "pdf.sandbox.js"; + var sandboxFileConfig = createWebpackConfig(defines, { filename: sandboxOutputName, library: sandboxAMDName, @@ -372,7 +373,7 @@ function createSandboxBundle(defines, code) { }); return ( gulp - .src("./src/scripting_api/quickjs-sandbox.js") + .src("./src/pdf.sandbox.js") .pipe(webpack2Stream(sandboxFileConfig)) .pipe(replaceWebpackRequire()) .pipe(replaceJSRootName(sandboxAMDName, "pdfjsSandbox")) diff --git a/src/scripting_api/quickjs-sandbox.js b/src/pdf.sandbox.js similarity index 91% rename from src/scripting_api/quickjs-sandbox.js rename to src/pdf.sandbox.js index cbf6e4e87..8bb6b37b8 100644 --- a/src/scripting_api/quickjs-sandbox.js +++ b/src/pdf.sandbox.js @@ -13,7 +13,12 @@ * limitations under the License. */ -import ModuleLoader from "../../external/quickjs/quickjs-eval.js"; +import ModuleLoader from "../external/quickjs/quickjs-eval.js"; + +/* eslint-disable-next-line no-unused-vars */ +const pdfjsVersion = PDFJSDev.eval("BUNDLE_VERSION"); +/* eslint-disable-next-line no-unused-vars */ +const pdfjsBuild = PDFJSDev.eval("BUNDLE_BUILD"); class Sandbox { constructor(module, testMode) {