Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-re

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-re - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

32

dist/rollup-plugin-re.cjs.js
/*!
* rollup-plugin-re v1.0.3
* rollup-plugin-re v1.0.4
* (c) 2017 jetiny 86287344@qq.com

@@ -15,6 +15,2 @@ * Release under the MIT License.

function isRegExp (re) {
return Object.prototype.toString.call(re) === '[object RegExp]'
}
function replace (options) {

@@ -39,3 +35,3 @@ if ( options === void 0 ) options = {};

it.matcher = it.match.test.bind(it.match);
} else if (typeof it.match === 'string') {
} else if (isString(it.match)) {
it.matcher = rollupPluginutils.createFilter(it.match);

@@ -46,7 +42,7 @@ }

it.testIsRegexp = true;
} else if (typeof it.test === 'string') {
} else if (isString(it.test)) {
it.testIsString = true;
}
// replace
if (typeof it.replace === 'string') {
if (isString(it.replace)) {
it.replaceIsString = true;

@@ -57,3 +53,3 @@ } else if (typeof it.replace === 'function') {

// content by file
if (typeof it.file === 'string') {
if (isString(it.file)) {
it.replaceContent = function (res) {

@@ -69,3 +65,3 @@ var file = path.resolve(res.id, '../', it.file);

// text
if (typeof it.text === 'string') {
if (isString(it.text)) {
it.replaceContent = function (res) {

@@ -105,3 +101,3 @@ res.content = it.text;

pattern.replaceContent(res);
if (res.content && res.content !== code) {
if (isString(res.content) && res.content !== code) {
hasReplacements = true;

@@ -115,3 +111,3 @@ magicString = new MagicString(res.content);

var newCode = pattern.transform(code, id);
if (newCode !== code) {
if (isString(newCode) && newCode !== code) {
hasReplacements = true;

@@ -134,3 +130,3 @@ magicString = new MagicString(newCode);

var str = pattern.replace.apply(null, match);
if (typeof str !== 'string') {
if (!isString(str)) {
throw new Error('[rollup-plugin-re] replace function should return a string')

@@ -154,3 +150,3 @@ }

var str$1 = pattern.replace();
if (typeof str$1 !== 'string') {
if (!isString(str$1)) {
throw new Error('[rollup-plugin-re] replace function should return a string')

@@ -177,2 +173,10 @@ }

function isRegExp (re) {
return Object.prototype.toString.call(re) === '[object RegExp]'
}
function isString (str) {
return typeof str === 'string'
}
module.exports = replace;
/*!
* rollup-plugin-re v1.0.3
* rollup-plugin-re v1.0.4
* (c) 2017 jetiny 86287344@qq.com

@@ -11,6 +11,2 @@ * Release under the MIT License.

function isRegExp (re) {
return Object.prototype.toString.call(re) === '[object RegExp]'
}
function replace (options) {

@@ -35,3 +31,3 @@ if ( options === void 0 ) options = {};

it.matcher = it.match.test.bind(it.match);
} else if (typeof it.match === 'string') {
} else if (isString(it.match)) {
it.matcher = createFilter(it.match);

@@ -42,7 +38,7 @@ }

it.testIsRegexp = true;
} else if (typeof it.test === 'string') {
} else if (isString(it.test)) {
it.testIsString = true;
}
// replace
if (typeof it.replace === 'string') {
if (isString(it.replace)) {
it.replaceIsString = true;

@@ -53,3 +49,3 @@ } else if (typeof it.replace === 'function') {

// content by file
if (typeof it.file === 'string') {
if (isString(it.file)) {
it.replaceContent = function (res) {

@@ -65,3 +61,3 @@ var file = resolve(res.id, '../', it.file);

// text
if (typeof it.text === 'string') {
if (isString(it.text)) {
it.replaceContent = function (res) {

@@ -101,3 +97,3 @@ res.content = it.text;

pattern.replaceContent(res);
if (res.content && res.content !== code) {
if (isString(res.content) && res.content !== code) {
hasReplacements = true;

@@ -111,3 +107,3 @@ magicString = new MagicString(res.content);

var newCode = pattern.transform(code, id);
if (newCode !== code) {
if (isString(newCode) && newCode !== code) {
hasReplacements = true;

@@ -130,3 +126,3 @@ magicString = new MagicString(newCode);

var str = pattern.replace.apply(null, match);
if (typeof str !== 'string') {
if (!isString(str)) {
throw new Error('[rollup-plugin-re] replace function should return a string')

@@ -150,3 +146,3 @@ }

var str$1 = pattern.replace();
if (typeof str$1 !== 'string') {
if (!isString(str$1)) {
throw new Error('[rollup-plugin-re] replace function should return a string')

@@ -173,2 +169,10 @@ }

function isRegExp (re) {
return Object.prototype.toString.call(re) === '[object RegExp]'
}
function isString (str) {
return typeof str === 'string'
}
export default replace;
{
"name": "rollup-plugin-re",
"version": "1.0.3",
"version": "1.0.4",
"description": "rollup replace plugin",

@@ -5,0 +5,0 @@ "main": "dist/rollup-plugin-re.cjs.js",

@@ -6,6 +6,2 @@ import { createFilter } from 'rollup-pluginutils'

function isRegExp (re) {
return Object.prototype.toString.call(re) === '[object RegExp]'
}
export default function replace (options = {}) {

@@ -28,3 +24,3 @@ const filter = createFilter(options.include, options.exclude)

it.matcher = it.match.test.bind(it.match)
} else if (typeof it.match === 'string') {
} else if (isString(it.match)) {
it.matcher = createFilter(it.match)

@@ -35,7 +31,7 @@ }

it.testIsRegexp = true
} else if (typeof it.test === 'string') {
} else if (isString(it.test)) {
it.testIsString = true
}
// replace
if (typeof it.replace === 'string') {
if (isString(it.replace)) {
it.replaceIsString = true

@@ -46,3 +42,3 @@ } else if (typeof it.replace === 'function') {

// content by file
if (typeof it.file === 'string') {
if (isString(it.file)) {
it.replaceContent = (res) => {

@@ -58,3 +54,3 @@ let file = resolve(res.id, '../', it.file)

// text
if (typeof it.text === 'string') {
if (isString(it.text)) {
it.replaceContent = (res) => {

@@ -94,3 +90,3 @@ res.content = it.text

pattern.replaceContent(res)
if (res.content && res.content !== code) {
if (isString(res.content) && res.content !== code) {
hasReplacements = true

@@ -104,3 +100,3 @@ magicString = new MagicString(res.content)

let newCode = pattern.transform(code, id)
if (newCode !== code) {
if (isString(newCode) && newCode !== code) {
hasReplacements = true

@@ -123,3 +119,3 @@ magicString = new MagicString(newCode)

let str = pattern.replace.apply(null, match)
if (typeof str !== 'string') {
if (!isString(str)) {
throw new Error('[rollup-plugin-re] replace function should return a string')

@@ -143,3 +139,3 @@ }

let str = pattern.replace()
if (typeof str !== 'string') {
if (!isString(str)) {
throw new Error('[rollup-plugin-re] replace function should return a string')

@@ -165,1 +161,9 @@ }

}
function isRegExp (re) {
return Object.prototype.toString.call(re) === '[object RegExp]'
}
function isString (str) {
return typeof str === 'string'
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc