rollup-plugin-inject
Advanced tools
Comparing version 3.0.0 to 3.0.1
# rollup-plugin-inject | ||
## 3.0.1 | ||
* Generate sourcemap when sourcemap enabled | ||
## 3.0.0 | ||
@@ -4,0 +8,0 @@ |
@@ -10,3 +10,3 @@ 'use strict'; | ||
const escape = (str) => { | ||
const escape = str => { | ||
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&"); | ||
@@ -37,3 +37,3 @@ }; | ||
const flatten = (node) => { | ||
const flatten = node => { | ||
const parts = []; | ||
@@ -70,5 +70,6 @@ | ||
modulesMap.forEach((mod, key) => { | ||
modulesMap.set(key, Array.isArray(mod) | ||
? [mod[0].split(path.sep).join("/"), mod[1]] | ||
: mod.split(path.sep).join("/")); | ||
modulesMap.set( | ||
key, | ||
Array.isArray(mod) ? [mod[0].split(path.sep).join("/"), mod[1]] : mod.split(path.sep).join("/") | ||
); | ||
}); | ||
@@ -83,3 +84,3 @@ } | ||
); | ||
const sourceMap = options.sourceMap !== false; | ||
const sourceMap = options.sourceMap !== false && options.sourcemap !== false; | ||
@@ -141,5 +142,3 @@ return { | ||
} else { | ||
newImports.set(hash, `import { ${mod[1]} as ${importLocalName} } from '${ | ||
mod[0] | ||
}';`); | ||
newImports.set(hash, `import { ${mod[1]} as ${importLocalName} } from '${mod[0]}';`); | ||
} | ||
@@ -189,7 +188,7 @@ } | ||
code, | ||
ast | ||
ast, | ||
map: sourceMap ? magicString.generateMap({ hires: true }) : null | ||
}; | ||
} | ||
const importBlock = Array.from(newImports.values()) | ||
.join("\n\n"); | ||
const importBlock = Array.from(newImports.values()).join("\n\n"); | ||
@@ -200,3 +199,3 @@ magicString.prepend(importBlock + "\n\n"); | ||
code: magicString.toString(), | ||
map: sourceMap ? magicString.generateMap() : null | ||
map: sourceMap ? magicString.generateMap({ hires: true }) : null | ||
}; | ||
@@ -203,0 +202,0 @@ } |
@@ -6,3 +6,3 @@ import { createFilter, attachScopes, makeLegalIdentifier } from 'rollup-pluginutils'; | ||
const escape = (str) => { | ||
const escape = str => { | ||
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&"); | ||
@@ -33,3 +33,3 @@ }; | ||
const flatten = (node) => { | ||
const flatten = node => { | ||
const parts = []; | ||
@@ -66,5 +66,6 @@ | ||
modulesMap.forEach((mod, key) => { | ||
modulesMap.set(key, Array.isArray(mod) | ||
? [mod[0].split(sep).join("/"), mod[1]] | ||
: mod.split(sep).join("/")); | ||
modulesMap.set( | ||
key, | ||
Array.isArray(mod) ? [mod[0].split(sep).join("/"), mod[1]] : mod.split(sep).join("/") | ||
); | ||
}); | ||
@@ -79,3 +80,3 @@ } | ||
); | ||
const sourceMap = options.sourceMap !== false; | ||
const sourceMap = options.sourceMap !== false && options.sourcemap !== false; | ||
@@ -137,5 +138,3 @@ return { | ||
} else { | ||
newImports.set(hash, `import { ${mod[1]} as ${importLocalName} } from '${ | ||
mod[0] | ||
}';`); | ||
newImports.set(hash, `import { ${mod[1]} as ${importLocalName} } from '${mod[0]}';`); | ||
} | ||
@@ -185,7 +184,7 @@ } | ||
code, | ||
ast | ||
ast, | ||
map: sourceMap ? magicString.generateMap({ hires: true }) : null | ||
}; | ||
} | ||
const importBlock = Array.from(newImports.values()) | ||
.join("\n\n"); | ||
const importBlock = Array.from(newImports.values()).join("\n\n"); | ||
@@ -196,3 +195,3 @@ magicString.prepend(importBlock + "\n\n"); | ||
code: magicString.toString(), | ||
map: sourceMap ? magicString.generateMap() : null | ||
map: sourceMap ? magicString.generateMap({ hires: true }) : null | ||
}; | ||
@@ -199,0 +198,0 @@ } |
{ | ||
"name": "rollup-plugin-inject", | ||
"description": "Scan modules for global variables and inject `import` statements where necessary", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"devDependencies": { | ||
"eslint": "^5.16.0", | ||
"mocha": "^6.0.0", | ||
"mocha": "^6.2.0", | ||
"prettier": "^1.18.2", | ||
"rollup": "^1.15.1", | ||
"rollup": "^1.17.0", | ||
"shx": "^0.3.2" | ||
@@ -31,3 +31,3 @@ }, | ||
"estree-walker": "^0.6.1", | ||
"magic-string": "^0.25.2", | ||
"magic-string": "^0.25.3", | ||
"rollup-pluginutils": "^2.8.1" | ||
@@ -34,0 +34,0 @@ }, |
@@ -7,3 +7,3 @@ import { attachScopes, createFilter, makeLegalIdentifier } from "rollup-pluginutils"; | ||
const escape = (str) => { | ||
const escape = str => { | ||
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&"); | ||
@@ -34,3 +34,3 @@ }; | ||
const flatten = (node) => { | ||
const flatten = node => { | ||
const parts = []; | ||
@@ -67,5 +67,6 @@ | ||
modulesMap.forEach((mod, key) => { | ||
modulesMap.set(key, Array.isArray(mod) | ||
? [mod[0].split(sep).join("/"), mod[1]] | ||
: mod.split(sep).join("/")); | ||
modulesMap.set( | ||
key, | ||
Array.isArray(mod) ? [mod[0].split(sep).join("/"), mod[1]] : mod.split(sep).join("/") | ||
); | ||
}); | ||
@@ -80,3 +81,3 @@ } | ||
); | ||
const sourceMap = options.sourceMap !== false; | ||
const sourceMap = options.sourceMap !== false && options.sourcemap !== false; | ||
@@ -138,5 +139,3 @@ return { | ||
} else { | ||
newImports.set(hash, `import { ${mod[1]} as ${importLocalName} } from '${ | ||
mod[0] | ||
}';`); | ||
newImports.set(hash, `import { ${mod[1]} as ${importLocalName} } from '${mod[0]}';`); | ||
} | ||
@@ -186,7 +185,7 @@ } | ||
code, | ||
ast | ||
ast, | ||
map: sourceMap ? magicString.generateMap({ hires: true }) : null | ||
}; | ||
} | ||
const importBlock = Array.from(newImports.values()) | ||
.join("\n\n"); | ||
const importBlock = Array.from(newImports.values()).join("\n\n"); | ||
@@ -197,3 +196,3 @@ magicString.prepend(importBlock + "\n\n"); | ||
code: magicString.toString(), | ||
map: sourceMap ? magicString.generateMap() : null | ||
map: sourceMap ? magicString.generateMap({ hires: true }) : null | ||
}; | ||
@@ -200,0 +199,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20184
0
463
Updatedmagic-string@^0.25.3