pdf.js/external/builder
Nicolò Ribaudo a352f28785
Fix transform of unary expression in Babel plugin
All of our static evaluation & dead-code elimination transforms need to
happen in post-order, transforming inner nodes first. This is so that
in complex nested cases all transforms see the simplified version of
their inner nodes.

For example:
  async getNimbusExperimentData() {
    if (!PDFJSDev.test("GECKOVIEW")) { return null; }
    // other code
  }
-> [evaluation of PDFJSDev.*]
  async getNimbusExperimentData() {
    if (!false) { return null; }
    // other code
  }
-> [!false -> true]
  async getNimbusExperimentData() {
    if (true) { return null; }
    // other code
  }
-> [if (true) -> replace with the if branch]
  async getNimbusExperimentData() {
    return null;
    // other code
  }
-> [early return -> remove dead code]
  async getNimbusExperimentData() {
    return null;
    // other code
  }

This was done correctly in all cases except for our `UnaryExpression`
transform, which was happening in pre-order.
2024-01-29 11:53:17 +01:00
..
fixtures Handle CSS-comments better in the preprocess-function (PR 14963 follow-up) 2022-06-02 16:06:47 +02:00
fixtures_esprima Fix transform of unary expression in Babel plugin 2024-01-29 11:53:17 +01:00
babel-plugin-pdfjs-preprocessor.mjs Fix transform of unary expression in Babel plugin 2024-01-29 11:53:17 +01:00
builder.mjs Use object destructuring, rather than the merge helper, in the gulpfile 2023-10-18 13:49:26 +02:00
test-fixtures_esprima.mjs Replace the webpack+acorn transform with a Babel plugin 2024-01-23 16:00:59 +01:00
test-fixtures.mjs Replace the webpack+acorn transform with a Babel plugin 2024-01-23 16:00:59 +01:00