From aaacdd478e4e57ff94d6ebd60d6790c4334f8a5c Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Mon, 18 Dec 2023 16:06:16 -0800 Subject: [PATCH] fix(evasive-transform): Do not use ?? nor ?. operators --- packages/evasive-transform/src/generate.js | 2 +- packages/evasive-transform/src/index.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/evasive-transform/src/generate.js b/packages/evasive-transform/src/generate.js index c946f7661c..2c002b805b 100644 --- a/packages/evasive-transform/src/generate.js +++ b/packages/evasive-transform/src/generate.js @@ -59,7 +59,7 @@ const { default: generator } = /** @type {any} */ (babelGenerate); export const generate = /** @type {GenerateAstWithSourceMap & GenerateAstWithoutSourceMap} */ ( (ast, options) => { - const sourceUrl = options?.sourceUrl; + const sourceUrl = options ? options.sourceUrl : undefined; const result = generator(ast, { sourceFileName: sourceUrl, sourceMaps: Boolean(sourceUrl), diff --git a/packages/evasive-transform/src/index.js b/packages/evasive-transform/src/index.js index 75d02f72f5..b6c4d2bd46 100644 --- a/packages/evasive-transform/src/index.js +++ b/packages/evasive-transform/src/index.js @@ -35,7 +35,10 @@ import { generate } from './generate.js'; * @public */ export async function evadeCensor(source, options) { - const { sourceMap, sourceUrl, useLocationUnmap, sourceType } = options ?? {}; + // We prefer to use ?? over || here, but we have razed the use of an old ESM + // emulation from our dependent packages graph + // https://www.npmjs.com/package/esm. + const { sourceMap, sourceUrl, useLocationUnmap, sourceType } = options || {}; // See "Chesterton's Fence" await null;