fix(parserOpts): don't allow nested export/import statements
Closes:
MODIFY
src/index.js
src/index.js
@@ -48,7 +48,6 @@ const makeModuleTransformer = (babelCore, importer) => {
const output = babelCore.transformSync(source, {
parserOpts: {
allowAwaitOutsideFunction: true,
- allowImportExportEverywhere: true,
plugins: parserPlugins,
},
generatorOpts: {

MODIFY
test/test-import.js
test/test-import.js
@@ -36,6 +36,13 @@ test('import', async t => {
transforms,
});
+ const exportNested = `(export default 123)`;
+ t.throws(
+ () => evaluateModule(exportNested),
+ SyntaxError,
+ `non-toplevel export fails`,
+ );
+
const srcNS = `import * as ns from 'module';`;
const importNS = await evaluateModule(srcNS);
const fsrcNS = importNS.staticRecord.functorSource;

fix(parserOpts): don't allow nested export/import statements

Closes: #5