From d937fd56e378d34a7531f5bc0eef597655904643 Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 25 Oct 2024 20:16:07 -0700 Subject: [PATCH] fixup module-source --- packages/module-source/src/transform-source.js | 5 +++-- packages/module-source/test/module-source.test.js | 3 ++- packages/module-source/test/preserve-format.test.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/module-source/src/transform-source.js b/packages/module-source/src/transform-source.js index bdbcdae300..a45b65b882 100644 --- a/packages/module-source/src/transform-source.js +++ b/packages/module-source/src/transform-source.js @@ -29,7 +29,7 @@ export const makeTransformSource = (makeModulePlugins, babel = null) => { const ast = parseBabel(source, { sourceType, tokens: true, - createParenthesizedExpression: true, + createParenthesizedExpressions: true, }); traverseBabel(ast, visitorFromPlugin(analyzePlugin)); @@ -44,8 +44,9 @@ export const makeTransformSource = (makeModulePlugins, babel = null) => { sourceFileName: sourceMapUrl, sourceMaps, inputSourceMap: sourceMap, - retainLines: true, + experimental_preserveFormat: true, preserveFormat: true, + retainLines: true, verbatim: true, }, source, diff --git a/packages/module-source/test/module-source.test.js b/packages/module-source/test/module-source.test.js index 0f8a1472cd..bc1dd6817b 100644 --- a/packages/module-source/test/module-source.test.js +++ b/packages/module-source/test/module-source.test.js @@ -70,7 +70,8 @@ test('export default', t => { function initialize(t, source, options = {}) { const { endowments, imports = new Map() } = options; const record = new ModuleSource(source); - // t.log(record.__syncModuleProgram__); + t.log(source); + t.log(record.__syncModuleProgram__); const liveUpdaters = {}; const onceUpdaters = {}; const namespace = {}; diff --git a/packages/module-source/test/preserve-format.test.js b/packages/module-source/test/preserve-format.test.js index d4d5d4c128..35cbd5ed56 100644 --- a/packages/module-source/test/preserve-format.test.js +++ b/packages/module-source/test/preserve-format.test.js @@ -2,7 +2,7 @@ import url from 'url'; import fs from 'fs'; import test from 'ava'; import { ModuleSource } from '../src/module-source.js'; -import './lockdown.js'; +import './_lockdown.js'; function readFixture(filename) { return fs.readFileSync(