fix(transform-module)!: Freeze module static records
MODIFY
packages/transform-module/NEWS.md
packages/transform-module/NEWS.md
The former were exported by `@babel/core`, but we are now using the
API that surfaces from `@babel/standalone` and our fork
`@agoric/babel-standalone`.
+* Module static records are now frozen.

MODIFY
packages/transform-module/src/main.js
packages/transform-module/src/main.js
import * as h from './hidden.js';
import makeModulePlugins from './babelPlugin.js';
+const { freeze } = Object;
+
const makeTransformSource = babel =>
function transformSource(source, sourceOptions = {}) {
// Transform the script/expression source for import expressions.
@@ -151,13 +153,13 @@ const makeCreateStaticRecord = transformSource =>
${scriptSource}
})`;
- const moduleStaticRecord = {
- exportAlls: sourceOptions.exportAlls,
- imports: sourceOptions.imports,
- liveExportMap: sourceOptions.liveExportMap,
- fixedExportMap: sourceOptions.fixedExportMap,
+ const moduleStaticRecord = freeze({
+ exportAlls: freeze(sourceOptions.exportAlls),
+ imports: freeze(sourceOptions.imports),
+ liveExportMap: freeze(sourceOptions.liveExportMap),
+ fixedExportMap: freeze(sourceOptions.fixedExportMap),
functorSource,
- };
+ });
// console.log(moduleStaticRecord);
return moduleStaticRecord;
};

fix(transform-module)!: Freeze module static records (#280)