diff --git a/cjs/rollup-plugin-import-manager.cjs b/cjs/rollup-plugin-import-manager.cjs index 926d9a8..7846f29 100644 --- a/cjs/rollup-plugin-import-manager.cjs +++ b/cjs/rollup-plugin-import-manager.cjs @@ -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 [mail@umamiappearance.eu] * @license MIT */ @@ -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)) { @@ -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); } diff --git a/cjs/rollup-plugin-import-manager.cjs.map b/cjs/rollup-plugin-import-manager.cjs.map index 33c95ff..17b5a7d 100644 --- a/cjs/rollup-plugin-import-manager.cjs.map +++ b/cjs/rollup-plugin-import-manager.cjs.map @@ -1 +1 @@ -{"version":3,"file":"rollup-plugin-import-manager.cjs","sources":["../src/diff.js","../src/index.js"],"sourcesContent":["import { diffLines, structuredPatch } from \"diff\";\nimport { blue, bold, red, green, gray } from \"colorette\";\n\n\n/**\n * Adds an angle bracket to each line of a\n * text section.\n * @param {string} angle - '>' or '<'\n * @param {string} txt - The text section.\n * @returns {string} - The given text section with an angle bracket and a space in front of each line. \n */\nconst addAngles = (angle, txt) => {\n const txtArr = txt.split(\"\\n\");\n let lastChar = \"\";\n if (txt.at(-1) === \"\\n\") {\n lastChar = \"\\n\";\n txtArr.pop();\n }\n let output = txtArr.map(line => `${angle} ${line}`).join(\"\\n\");\n output += lastChar;\n return output;\n};\n\n\n/**\n * Prints an output in the mould of GNU diff when\n * called with no parameters other than the files.\n * But more picturesque, thanks to red and green\n * colors...\n * Also possible is a \"file\" mode. This variant\n * shows the whole file with added and removed\n * lines.\n * @param {string} source - The original code.\n * @param {string} code - The modified code.\n * @param {string} [diffOption] - As passed by the user. If the value is 'file' also unchanged code is printed. \n */\nconst showDiff = (filename, source, code, diffOption) => {\n const fileMode = diffOption == \"file\";\n \n console.log(bold(blue(\n `(plugin ImportManager) diff for file '${filename}':`\n )));\n \n console.log(gray(\"BEGIN >>>\"));\n\n if (fileMode) {\n const diff = diffLines(source, code);\n\n let message = \"\";\n \n diff.forEach((part) => {\n let msg;\n if (part.added) {\n msg = green(addAngles(\">\", part.value));\n } else if (part.removed) {\n msg = red(addAngles(\"<\", part.value));\n } else {\n msg = part.value;\n }\n message += msg;\n });\n \n console.log(message);\n \n }\n \n else {\n const diff = structuredPatch(\"\", \"\", source, code, \"\", \"\", {\n context: 0\n });\n \n for (const part of diff.hunks) {\n\n // add\n if (part.oldLines === 0) {\n let info = `${part.oldStart}a${part.newStart}`;\n if (part.newLines > 1) {\n info += `,${part.newStart+part.newLines-1}`;\n }\n console.log(bold(info));\n part.lines.forEach(line => console.log(green(`> ${line.slice(1)}`)));\n }\n \n // delete\n else if (part.newLines === 0) {\n let info = String(part.oldStart);\n if (part.oldLines > 1) {\n info += `,${part.oldStart+part.oldLines-1}`;\n }\n info += `d${part.newLines}`;\n console.log(bold(info));\n part.lines.forEach(line => console.log(red(`< ${line.slice(1)}`)));\n }\n \n // change\n else {\n let info = String(part.oldStart);\n if (part.oldLines > 1) {\n info += `,${part.oldStart+part.oldLines-1}`;\n }\n info += `c${part.newStart}`;\n if (part.newLines > 1) {\n info += `,${part.newStart+part.newLines-1}`;\n }\n console.log(bold(info));\n \n let plus = false;\n part.lines.forEach((line, i) => {\n if (plus) {\n console.log(green(`> ${line.slice(1)}`));\n } else {\n console.log(red(`< ${line.slice(1)}`));\n if (part.lines[i+1].at(0) === \"+\") {\n console.log(\"---\");\n plus = true;\n }\n }\n });\n }\n }\n }\n \n console.log(gray(\"<<< END\\n\"));\n};\n\nexport default showDiff;\n","/**\n * [rollup-plugin-import-manager]{@link https://github.com/UmamiAppearance/rollup-plugin-import-manager}\n *\n * @version 0.3.7\n * @author UmamiAppearance [mail@umamiappearance.eu]\n * @license MIT\n */\n\n\nimport { createFilter } from \"@rollup/pluginutils\";\nimport { ImportManager } from \"import-manager\";\nimport showDiff from \"./diff.js\";\n\n// test if input is an object\nconst isObject = input => typeof input === \"object\" && !Array.isArray(input) && input !== null;\n\n// helper to allow string and array\nconst ensureArray = (arr) => Array.isArray(arr) ? arr : [arr];\n\n// helper to allow string and object\nconst ensureObj = (input) => {\n\n if (typeof input === \"string\") {\n const output = {};\n output[input] = null;\n return output;\n }\n \n else if (isObject(input)) {\n return input;\n }\n \n throw new TypeError(\"Only strings and objects are allowed for actions.\");\n \n};\n\n// makes the life of the user a little bit easier\n// by accepting multiple versions of boolean vars \nconst bool = (b) => !(Boolean(b) === false || (/^(?:false|no?|0)$/i).test(String(b)));\n\n// allow some variations to enable object mode \n// for debugging\nconst showObjects = (v) => (/^(?:objects?|imports?|verbose)$/).test(String(v));\n\n\n// main\nconst importManager = (options={}) => {\n\n const filter = createFilter(options.include, options.exclude);\n\n // Initialize a new set to be passed to every \n // ImportManager instance. It keeps track of\n // warnings, that were shown already.\n const warnSpamProtection = new Set();\n \n return {\n name: \"ImportManager\",\n \n transform (source, id) {\n if (!filter(id)) return;\n\n const warnings = typeof options.warnings === \"undefined\" ? true : bool(options.warnings);\n\n const manager = new ImportManager(source, id, warnSpamProtection, warnings); \n\n if (!(\"units\" in options) || \"debug\" in options) {\n if (showObjects(options.debug)) {\n manager.logUnitObjects();\n } else {\n manager.logUnits();\n }\n }\n \n else {\n\n for (const unitSection of ensureArray(options.units)) {\n\n let allowId = false; \n let allowNull = true;\n\n if (\"file\" in unitSection) {\n const isMatch = createFilter(unitSection.file);\n\n if (!isMatch(id)) {\n continue;\n }\n\n allowId = true;\n allowNull = false;\n }\n\n\n // a little helper function to select a unit\n const selectUnit = (section) => {\n if (!isObject(section)) {\n throw new TypeError(\"Input must be an object.\");\n }\n\n let unit = null;\n \n if (\"id\" in section) {\n if (allowId) {\n manager.warning(\"Selecting modules via Id should only be used for testing.\");\n unit = manager.selectModById(section.id, allowNull);\n } else {\n throw new Error(\"Filename must be specified for selecting via Id.\");\n }\n } else if (\"hash\" in section) {\n unit = manager.selectModByHash(section.hash, allowNull);\n } else if (\"module\" in section) {\n unit = manager.selectModByName(section.module, section.type, allowNull);\n }\n \n return unit;\n };\n\n \n // creating units from scratch\n if (\"createModule\" in unitSection || \"addCode\" in unitSection) {\n\n let codeSnippet;\n\n if (\"createModule\" in unitSection) {\n\n if (allowNull) {\n manager.warning(\"No file specified for import statement creation! If the build fails, this could be the reason.\");\n }\n\n const module = unitSection.createModule;\n let type = unitSection.type;\n\n const mem = {\n defaultMembers: [],\n members: []\n };\n\n if (\"actions\" in unitSection) {\n for (let action of ensureArray(unitSection.actions)) {\n action = ensureObj(action);\n if ((action.select === \"members\" || action.select === \"defaultMembers\") && \"add\" in action) {\n mem[action.select] = ensureArray(action.add); \n }\n }\n }\n\n if (mem.defaultMembers.length || mem.members.length) {\n type = \"es6\";\n }\n\n \n if (!type) {\n throw new TypeError(\"If no (default) members are specified, the type cannot be determined and must be specified by passing 'type: \\\"cjs\\\"|\\\"dynamic\\\"|\\\"es6\\\"'\");\n } else if (type === \"es6\") {\n codeSnippet = manager.makeES6Statement(module, mem.defaultMembers, mem.members);\n } else {\n const declarators = /^(?:const|let|var|global)$/;\n const [ declarator, varname ] = Object.entries(unitSection).filter(e => declarators.test(e[0])).at(0) || [ null, null ];\n\n if (!declarator || !varname) {\n throw new TypeError(\"dynamic and cjs imports require a valid declarator key (const|let|var|global) and a value for the variable name.\");\n }\n\n if (type === \"cjs\") {\n codeSnippet = manager.makeCJSStatement(module, declarator, varname);\n } else if (type === \"dynamic\") {\n codeSnippet = manager.makeDynamicStatement(module, declarator, varname);\n }\n }\n }\n \n else {\n codeSnippet = unitSection.addCode;\n if (!(codeSnippet && typeof codeSnippet === \"string\")) {\n throw new TypeError(\"'addCode' must be a non empty string.\");\n }\n }\n \n let mode;\n for (const key in unitSection) {\n const targetMatch = key.match(/^(?:(?:ap|pre)pend|replace)$/);\n if (targetMatch) {\n mode = targetMatch.at(0);\n break;\n }\n }\n \n if (mode) {\n // look for the target with the values at key 'append|prepend|replace'\n const target = selectUnit(unitSection[mode]);\n \n // insert if match is found\n // (which can be undefined if no file specified)\n if (target) {\n manager.insertAtUnit(target, mode, codeSnippet);\n }\n }\n\n else {\n const type = unitSection.type === \"cjs\" ? \"cjs\" : \"es6\";\n manager.insertStatement(codeSnippet, unitSection.insert, type);\n }\n\n continue;\n }\n \n\n // select existing units\n const unit = selectUnit(unitSection);\n if (!unit) {\n continue;\n }\n \n \n if (\"actions\" in unitSection) {\n\n for (let action of ensureArray(unitSection.actions)) {\n \n action = ensureObj(action);\n \n if (\"debug\" in action) {\n unit.methods.log(); \n }\n \n else if (\"select\" in action) {\n\n // module\n if (action.select === \"module\" && \"rename\" in action) {\n const modType = (\"modType\" in action) ? action.modType : unit.module.type;\n unit.methods.renameModule(action.rename, modType);\n }\n\n // single (default) member\n else if (action.select === \"member\" || action.select === \"defaultMember\" ) {\n const memberType = action.select;\n \n if (\"alias\" in action) {\n const alias = \"remove\" in action ? null : action.alias;\n unit.methods.setAlias(memberType, action.name, alias);\n }\n \n else if (\"rename\" in action) {\n const keepAlias = \"keepAlias\" in action ? bool(action.keepAlias) : false;\n unit.methods.renameMember(memberType, action.name, action.rename, keepAlias);\n }\n\n else if (\"remove\" in action) {\n unit.methods.removeMember(memberType, action.name);\n }\n\n }\n\n // entire group of (default) members\n else if (action.select === \"members\" || action.select === \"defaultMembers\") {\n if (\"remove\" in action) {\n unit.methods.removeMembers(action.select);\n }\n\n if (\"add\" in action) {\n if (action.select === \"members\") {\n unit.methods.addMembers(ensureArray(action.add));\n } else {\n unit.methods.addDefaultMembers(ensureArray(action.add));\n }\n } \n }\n }\n \n // remove the entire unit\n else if (\"remove\" in action) {\n manager.remove(unit);\n continue;\n }\n\n // apply the changes to the code\n manager.commitChanges(unit);\n }\n }\n }\n }\n\n const code = manager.code.toString();\n \n if (\"showDiff\" in options && manager.code.hasChanged()) {\n showDiff(id, source, code, options.showDiff);\n }\n \n let map;\n\n if (options.sourceMap !== false && options.sourcemap !== false) {\n map = manager.code.generateMap({ hires: true });\n }\n\n return { code, map };\n }\n };\n};\n \nexport { importManager };\n"],"names":["bold","blue","gray","diff","diffLines","green","red","structuredPatch","createFilter","ImportManager"],"mappings":";;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK;AAClC,IAAI,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACnC,IAAI,IAAI,QAAQ,GAAG,EAAE,CAAC;AACtB,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;AAC7B,QAAQ,QAAQ,GAAG,IAAI,CAAC;AACxB,QAAQ,MAAM,CAAC,GAAG,EAAE,CAAC;AACrB,KAAK;AACL,IAAI,IAAI,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnE,IAAI,MAAM,IAAI,QAAQ,CAAC;AACvB,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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A6B;AAC7B;AACA;AACA,4BAA4B,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AACxD,yBAAyB;AACzB,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb;AACA,YAAY,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;AACjD;AACA,YAAY,IAAI,UAAU,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;AACpE,gBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC7D,aAAa;AACb;AACA,YAAY,IAAI,GAAG,CAAC;AACpB;AACA,YAAY,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK,EAAE;AAC5E,gBAAgB,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAChE,aAAa;AACb;AACA,YAAY,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACjC,SAAS;AACT,KAAK,CAAC;AACN;;;;"} \ No newline at end of file +{"version":3,"file":"rollup-plugin-import-manager.cjs","sources":["../src/diff.js","../src/index.js"],"sourcesContent":["import { diffLines, structuredPatch } from \"diff\";\nimport { blue, bold, red, green, gray } from \"colorette\";\n\n\n/**\n * Adds an angle bracket to each line of a\n * text section.\n * @param {string} angle - '>' or '<'\n * @param {string} txt - The text section.\n * @returns {string} - The given text section with an angle bracket and a space in front of each line. \n */\nconst addAngles = (angle, txt) => {\n const txtArr = txt.split(\"\\n\");\n let lastChar = \"\";\n if (txt.at(-1) === \"\\n\") {\n lastChar = \"\\n\";\n txtArr.pop();\n }\n let output = txtArr.map(line => `${angle} ${line}`).join(\"\\n\");\n output += lastChar;\n return output;\n};\n\n\n/**\n * Prints an output in the mould of GNU diff when\n * called with no parameters other than the files.\n * But more picturesque, thanks to red and green\n * colors...\n * Also possible is a \"file\" mode. This variant\n * shows the whole file with added and removed\n * lines.\n * @param {string} source - The original code.\n * @param {string} code - The modified code.\n * @param {string} [diffOption] - As passed by the user. If the value is 'file' also unchanged code is printed. \n */\nconst showDiff = (filename, source, code, diffOption) => {\n const fileMode = diffOption == \"file\";\n \n console.log(bold(blue(\n `(plugin ImportManager) diff for file '${filename}':`\n )));\n \n console.log(gray(\"BEGIN >>>\"));\n\n if (fileMode) {\n const diff = diffLines(source, code);\n\n let message = \"\";\n \n diff.forEach((part) => {\n let msg;\n if (part.added) {\n msg = green(addAngles(\">\", part.value));\n } else if (part.removed) {\n msg = red(addAngles(\"<\", part.value));\n } else {\n msg = part.value;\n }\n message += msg;\n });\n \n console.log(message);\n \n }\n \n else {\n const diff = structuredPatch(\"\", \"\", source, code, \"\", \"\", {\n context: 0\n });\n \n for (const part of diff.hunks) {\n\n // add\n if (part.oldLines === 0) {\n let info = `${part.oldStart}a${part.newStart}`;\n if (part.newLines > 1) {\n info += `,${part.newStart+part.newLines-1}`;\n }\n console.log(bold(info));\n part.lines.forEach(line => console.log(green(`> ${line.slice(1)}`)));\n }\n \n // delete\n else if (part.newLines === 0) {\n let info = String(part.oldStart);\n if (part.oldLines > 1) {\n info += `,${part.oldStart+part.oldLines-1}`;\n }\n info += `d${part.newLines}`;\n console.log(bold(info));\n part.lines.forEach(line => console.log(red(`< ${line.slice(1)}`)));\n }\n \n // change\n else {\n let info = String(part.oldStart);\n if (part.oldLines > 1) {\n info += `,${part.oldStart+part.oldLines-1}`;\n }\n info += `c${part.newStart}`;\n if (part.newLines > 1) {\n info += `,${part.newStart+part.newLines-1}`;\n }\n console.log(bold(info));\n \n let plus = false;\n part.lines.forEach((line, i) => {\n if (plus) {\n console.log(green(`> ${line.slice(1)}`));\n } else {\n console.log(red(`< ${line.slice(1)}`));\n if (part.lines[i+1].at(0) === \"+\") {\n console.log(\"---\");\n plus = true;\n }\n }\n });\n }\n }\n }\n \n console.log(gray(\"<<< END\\n\"));\n};\n\nexport default showDiff;\n","/**\n * [rollup-plugin-import-manager]{@link https://github.com/UmamiAppearance/rollup-plugin-import-manager}\n *\n * @version 0.4.0\n * @author UmamiAppearance [mail@umamiappearance.eu]\n * @license MIT\n */\n\n\nimport { createFilter } from \"@rollup/pluginutils\";\nimport { ImportManager } from \"import-manager\";\nimport showDiff from \"./diff.js\";\n\n// test if input is an object\nconst isObject = input => typeof input === \"object\" && !Array.isArray(input) && input !== null;\n\n// helper to allow string and array\nconst ensureArray = (arr) => Array.isArray(arr) ? arr : [arr];\n\n// helper to allow string and object\nconst ensureObj = (input) => {\n\n if (typeof input === \"string\") {\n const output = {};\n output[input] = null;\n return output;\n }\n \n else if (isObject(input)) {\n return input;\n }\n \n throw new TypeError(\"Only strings and objects are allowed for actions.\");\n \n};\n\n// makes the life of the user a little bit easier\n// by accepting multiple versions of boolean vars \nconst bool = (b) => !(Boolean(b) === false || (/^(?:false|no?|0)$/i).test(String(b)));\n\n// allow some variations to enable object mode \n// for debugging\nconst showObjects = (v) => (/^(?:objects?|imports?|verbose)$/).test(String(v));\n\n\n// main\nconst importManager = (options={}) => {\n\n const filter = createFilter(options.include, options.exclude);\n\n // Initialize a new set to be passed to every \n // ImportManager instance. It keeps track of\n // warnings, that were shown already.\n const warnSpamProtection = new Set();\n \n return {\n name: \"ImportManager\",\n \n transform (source, id) {\n if (!filter(id)) return;\n\n const warnings = typeof options.warnings === \"undefined\" ? true : bool(options.warnings);\n\n const manager = new ImportManager(source, id, warnSpamProtection, warnings, this); \n\n if (!(\"units\" in options) || \"debug\" in options) {\n if (showObjects(options.debug)) {\n manager.logUnitObjects();\n } else {\n manager.logUnits();\n }\n }\n \n else {\n\n for (const unitSection of ensureArray(options.units)) {\n\n let allowId = false; \n let allowNull = true;\n\n if (\"file\" in unitSection) {\n const isMatch = createFilter(unitSection.file);\n\n if (!isMatch(id)) {\n continue;\n }\n\n allowId = true;\n allowNull = false;\n }\n\n\n // a little helper function to select a unit\n const selectUnit = (section) => {\n if (!isObject(section)) {\n throw new TypeError(\"Input must be an object.\");\n }\n\n let unit = null;\n \n if (\"id\" in section) {\n if (allowId) {\n manager.warning(\"Selecting modules via Id should only be used for testing.\");\n unit = manager.selectModById(section.id, allowNull);\n } else {\n throw new Error(\"Filename must be specified for selecting via Id.\");\n }\n } else if (\"hash\" in section) {\n unit = manager.selectModByHash(section.hash, allowNull);\n } else if (\"module\" in section) {\n unit = manager.selectModByName(section.module, section.type, allowNull);\n }\n \n return unit;\n };\n\n \n // creating units from scratch\n if (\"createModule\" in unitSection || \"addCode\" in unitSection) {\n\n let codeSnippet;\n\n if (\"createModule\" in unitSection) {\n\n if (allowNull) {\n manager.warning(\"No file specified for import statement creation! If the build fails, this could be the reason.\");\n }\n\n const module = unitSection.createModule;\n let type = unitSection.type;\n\n const mem = {\n defaultMembers: [],\n members: []\n };\n\n if (\"actions\" in unitSection) {\n for (let action of ensureArray(unitSection.actions)) {\n action = ensureObj(action);\n if ((action.select === \"members\" || action.select === \"defaultMembers\") && \"add\" in action) {\n mem[action.select] = ensureArray(action.add); \n }\n }\n }\n\n if (mem.defaultMembers.length || mem.members.length) {\n type = \"es6\";\n }\n\n \n if (!type) {\n throw new TypeError(\"If no (default) members are specified, the type cannot be determined and must be specified by passing 'type: \\\"cjs\\\"|\\\"dynamic\\\"|\\\"es6\\\"'\");\n } else if (type === \"es6\") {\n codeSnippet = manager.makeES6Statement(module, mem.defaultMembers, mem.members);\n } else {\n const declarators = /^(?:const|let|var|global)$/;\n const [ declarator, varname ] = Object.entries(unitSection).filter(e => declarators.test(e[0])).at(0) || [ null, null ];\n\n if (!declarator || !varname) {\n throw new TypeError(\"dynamic and cjs imports require a valid declarator key (const|let|var|global) and a value for the variable name.\");\n }\n\n if (type === \"cjs\") {\n codeSnippet = manager.makeCJSStatement(module, declarator, varname);\n } else if (type === \"dynamic\") {\n codeSnippet = manager.makeDynamicStatement(module, declarator, varname);\n }\n }\n }\n \n else {\n codeSnippet = unitSection.addCode;\n if (!(codeSnippet && typeof codeSnippet === \"string\")) {\n throw new TypeError(\"'addCode' must be a non empty string.\");\n }\n }\n \n let mode;\n for (const key in unitSection) {\n const targetMatch = key.match(/^(?:(?:ap|pre)pend|replace)$/);\n if (targetMatch) {\n mode = targetMatch.at(0);\n break;\n }\n }\n \n if (mode) {\n // look for the target with the values at key 'append|prepend|replace'\n const target = selectUnit(unitSection[mode]);\n \n // insert if match is found\n // (which can be undefined if no file specified)\n if (target) {\n manager.insertAtUnit(target, mode, codeSnippet);\n }\n }\n\n else {\n // default is es6\n let type = \"es6\";\n\n // overwrite this if set by the config\n if (unitSection.type) {\n type = unitSection.type;\n } \n \n // if type is dynamic change to es6 if is6 imports\n // are found (as dynamic imports can be wildly spread)\n \n if (type === \"dynamic\" && manager.imports.es6.length) {\n type = \"es6\";\n }\n\n manager.insertStatement(codeSnippet, unitSection.insert, type);\n }\n\n continue;\n }\n \n\n // select existing units\n const unit = selectUnit(unitSection);\n if (!unit) {\n continue;\n }\n \n \n if (\"actions\" in unitSection) {\n\n for (let action of ensureArray(unitSection.actions)) {\n \n action = ensureObj(action);\n \n if (\"debug\" in action) {\n unit.methods.log(); \n }\n \n else if (\"select\" in action) {\n\n // module\n if (action.select === \"module\" && \"rename\" in action) {\n const modType = (\"modType\" in action) ? action.modType : unit.module.type;\n unit.methods.renameModule(action.rename, modType);\n }\n\n // single (default) member\n else if (action.select === \"member\" || action.select === \"defaultMember\" ) {\n const memberType = action.select;\n \n if (\"alias\" in action) {\n const alias = \"remove\" in action ? null : action.alias;\n unit.methods.setAlias(memberType, action.name, alias);\n }\n \n else if (\"rename\" in action) {\n const keepAlias = \"keepAlias\" in action ? bool(action.keepAlias) : false;\n unit.methods.renameMember(memberType, action.name, action.rename, keepAlias);\n }\n\n else if (\"remove\" in action) {\n unit.methods.removeMember(memberType, action.name);\n }\n\n }\n\n // entire group of (default) members\n else if (action.select === \"members\" || action.select === \"defaultMembers\") {\n if (\"remove\" in action) {\n unit.methods.removeMembers(action.select);\n }\n\n if (\"add\" in action) {\n if (action.select === \"members\") {\n unit.methods.addMembers(ensureArray(action.add));\n } else {\n unit.methods.addDefaultMembers(ensureArray(action.add));\n }\n } \n }\n }\n \n // remove the entire unit\n else if (\"remove\" in action) {\n manager.remove(unit);\n continue;\n }\n\n // apply the changes to the code\n manager.commitChanges(unit);\n }\n }\n }\n }\n\n const code = manager.code.toString();\n \n if (\"showDiff\" in options && manager.code.hasChanged()) {\n showDiff(id, source, code, options.showDiff);\n }\n \n let map;\n\n if (options.sourceMap !== false && options.sourcemap !== false) {\n map = manager.code.generateMap({ hires: true });\n }\n\n return { code, map };\n }\n };\n};\n \nexport { importManager };\n"],"names":["bold","blue","gray","diff","diffLines","green","red","structuredPatch","createFilter","ImportManager"],"mappings":";;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK;AAClC,IAAI,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACnC,IAAI,IAAI,QAAQ,GAAG,EAAE,CAAC;AACtB,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;AAC7B,QAAQ,QAAQ,GAAG,IAAI,CAAC;AACxB,QAAQ,MAAM,CAAC,GAAG,EAAE,CAAC;AACrB,KAAK;AACL,IAAI,IAAI,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnE,IAAI,MAAM,IAAI,QAAQ,CAAC;AACvB,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,QAAQ,GAAG,CAAC,QA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,CAAC,GAAG,CAAC,CAAC,CAAC;AACpG,yCAAyC;AACzC,qCAAqC;AACrC,iCAAiC;AACjC,6BAA6B;AAC7B;AACA;AACA,iCAAiC,IAAI,QAAQ,IAAI,MAAM,EAAE;AACzD,gCAAgC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACrD,gCAAgC,SAAS;AACzC,6BAA6B;AAC7B;AACA;AACA,4BAA4B,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AACxD,yBAAyB;AACzB,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb;AACA,YAAY,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;AACjD;AACA,YAAY,IAAI,UAAU,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;AACpE,gBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC7D,aAAa;AACb;AACA,YAAY,IAAI,GAAG,CAAC;AACpB;AACA,YAAY,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK,EAAE;AAC5E,gBAAgB,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAChE,aAAa;AACb;AACA,YAAY,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACjC,SAAS;AACT,KAAK,CAAC;AACN;;;;"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c73ff71..da26738 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "rollup-plugin-import-manager", - "version": "0.3.7", + "version": "0.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rollup-plugin-import-manager", - "version": "0.3.7", + "version": "0.4.0", "license": "MIT", "dependencies": { "@rollup/pluginutils": "^5.0.2", "colorette": "^2.0.19", "diff": "^5.1.0", - "import-manager": "^0.1.7" + "import-manager": "^0.2.0" }, "devDependencies": { "ava": "^5.1.0", @@ -1398,9 +1398,9 @@ } }, "node_modules/import-manager": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/import-manager/-/import-manager-0.1.7.tgz", - "integrity": "sha512-BovvyV/paNz173r2KUEQEdup2N8GHV4K1QFxZ6IZfUsbXJFeynv1OPMKlKRfq81EqdcAVsknZdKIUnfwUgPuQg==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/import-manager/-/import-manager-0.2.0.tgz", + "integrity": "sha512-+OvxDAQh1DBV2kteJNwJrPw5zUEW1YqMwhgjtrGx6aQxaaaW37E71ey1eeG/m2/LQLvph3GytWEcDbx/HK151w==", "dependencies": { "acorn": "^8.8.1", "acorn-walk": "^8.2.0", @@ -2157,9 +2157,9 @@ } }, "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz", + "integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==", "dev": true, "engines": { "node": ">=6" diff --git a/package.json b/package.json index 973ee00..caf6228 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,13 @@ "add", "cjs", "es6", + "delete", "dynamic", "import", + "import-manager", "modules", "remove", + "replace", "rollup", "rollup-plugin", "rollup-plugin-import-manager", @@ -42,7 +45,7 @@ "@rollup/pluginutils": "^5.0.2", "colorette": "^2.0.19", "diff": "^5.1.0", - "import-manager": "^0.1.7" + "import-manager": "^0.2.0" }, "devDependencies": { "ava": "^5.1.0",