Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Dorda committed Nov 1, 2021
1 parent 6a18cf7 commit 9885763
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions dev/mjs2js.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// .mjs -> es6 -> native js
const fs = require('fs-extra');
const consola = require('console');
const { find } = require('./shimport');

// Replaces all imports, exports in a file
Expand Down Expand Up @@ -59,11 +60,8 @@ const transform = (file, source, id, namespace) => {
});

if (moduleHaDefaultExport && moduleHasNamedExport) {
console.log(exportDeclarations);
consola.error(
`es2Wdefine detected combination of named and default exports in one module: ${gray(
id,
)}`,
`es2Wdefine detected combination of named and default exports in one module: ${id}`,
);
}

Expand Down Expand Up @@ -116,9 +114,7 @@ const transform = (file, source, id, namespace) => {
});
if (moduleHaDefaultImport && moduleHasNamedImport) {
consola.error(
`es2Wdefine detected combination of named and default import in one module: ${gray(
id,
)}`,
`es2Wdefine detected combination of named and default import in one module: ${id}`,
);
}
});
Expand Down Expand Up @@ -148,5 +144,8 @@ const transform = (file, source, id, namespace) => {
});
transformed += '\n});\n';

// replace trailing ; at the end of commented out lines
transformed = transformed.replace(/(^\/\*import\s+.*\*\/);/gm, '$1');

return { externalModules, transformed };
};

0 comments on commit 9885763

Please sign in to comment.