Skip to content

Commit

Permalink
v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
UmamiAppearance committed Jan 11, 2023
1 parent 0edee7b commit 64f6b35
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
20 changes: 17 additions & 3 deletions cjs/rollup-plugin-import-manager.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const showDiff = (filename, source, code, diffOption) => {
/**
* [rollup-plugin-import-manager]{@link https://github.com/UmamiAppearance/rollup-plugin-import-manager}
*
* @version 0.3.7
* @version 0.4.0
* @author UmamiAppearance [[email protected]]
* @license MIT
*/
Expand Down Expand Up @@ -184,7 +184,7 @@ const importManager = (options={}) => {

const warnings = typeof options.warnings === "undefined" ? true : bool(options.warnings);

const manager = new importManager$1.ImportManager(source, id, warnSpamProtection, warnings);
const manager = new importManager$1.ImportManager(source, id, warnSpamProtection, warnings, this);

if (!("units" in options) || "debug" in options) {
if (showObjects(options.debug)) {
Expand Down Expand Up @@ -319,7 +319,21 @@ const importManager = (options={}) => {
}

else {
const type = unitSection.type === "cjs" ? "cjs" : "es6";
// default is es6
let type = "es6";

// overwrite this if set by the config
if (unitSection.type) {
type = unitSection.type;
}

// if type is dynamic change to es6 if is6 imports
// are found (as dynamic imports can be wildly spread)

if (type === "dynamic" && manager.imports.es6.length) {
type = "es6";
}

manager.insertStatement(codeSnippet, unitSection.insert, type);
}

Expand Down
Loading

0 comments on commit 64f6b35

Please sign in to comment.