Skip to content

Commit

Permalink
fix(compartment-mapper): sync module transforms in bundle.js
Browse files Browse the repository at this point in the history
Co-authored-by: naugtur <[email protected]>
  • Loading branch information
leotm and naugtur committed Dec 3, 2024
1 parent 918c051 commit b062845
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 2 additions & 0 deletions packages/compartment-mapper/src/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export const makeBundle = async (readPowers, moduleLocation, options) => {

const {
moduleTransforms,
syncModuleTransforms,
dev,
tags: tagsOption,
conditions: conditionsOption = tagsOption,
Expand Down Expand Up @@ -327,6 +328,7 @@ export const makeBundle = async (readPowers, moduleLocation, options) => {
resolve,
makeImportHook,
moduleTransforms,
syncModuleTransforms,
parserForLanguage,
});
await compartment.load(entryModuleSpecifier);
Expand Down
6 changes: 3 additions & 3 deletions packages/ses/scripts/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const writeBundle = async ({ buildType } = {}) => {
const packageJson = JSON.parse(text);
const version = packageJson.version;

let moduleTransforms;
let syncModuleTransforms;

let bundleFilePaths = [
'dist/ses.cjs',
Expand All @@ -44,13 +44,13 @@ const writeBundle = async ({ buildType } = {}) => {
if (buildType === 'hermes') {
bundleFilePaths = ['dist/ses-hermes.cjs'];
terseFilePaths = [];
moduleTransforms = hermesTransforms;
syncModuleTransforms = hermesTransforms;
}

const bundle = await makeBundle(
read,
pathToFileURL(resolve('../index.js', import.meta.url)).toString(),
{ moduleTransforms },
{ syncModuleTransforms },
);
const versionedBundle = `// ses@${version}\n${bundle}`;

Expand Down
8 changes: 1 addition & 7 deletions packages/ses/scripts/hermes-transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,7 @@ const asyncGeneratorDestroyer = {
};

export const hermesTransforms = {
mjs: async (
sourceBytes,
specifier,
location,
_packageLocation,
{ sourceMap },
) => {
mjs: (sourceBytes, specifier, location, _packageLocation, { sourceMap }) => {
const transforms = {
...asyncArrowEliminator,
...asyncGeneratorDestroyer,
Expand Down

0 comments on commit b062845

Please sign in to comment.