Socket
Socket
Sign inDemoInstall

rollup-pluginutils

Package Overview
Dependencies
1
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.8.0 to 2.8.1

4

CHANGELOG.md
# rollup-pluginutils changelog
## 2.8.1
*2019-06-04*
* Support serialization of many edge cases ([#64](https://github.com/rollup/rollup-pluginutils/issues/64))
## 2.8.0

@@ -4,0 +8,0 @@ *2019-05-30*

10

package.json
{
"name": "rollup-pluginutils",
"description": "Functionality commonly needed by Rollup plugins",
"version": "2.8.0",
"version": "2.8.1",
"main": "dist/pluginutils.cjs.js",

@@ -18,3 +18,3 @@ "module": "dist/pluginutils.es.js",

"@types/micromatch": "^3.1.0",
"@types/node": "^12.0.3",
"@types/node": "^12.0.4",
"husky": "^2.3.0",

@@ -25,9 +25,9 @@ "jest": "^24.8.0",

"prettier": "^1.17.1",
"rollup": "^1.12.4",
"rollup": "^1.13.1",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-node-resolve": "^5.0.1",
"rollup-plugin-typescript": "^1.0.1",
"shx": "^0.3.2",
"ts-jest": "^24.0.2",
"tslint": "^5.16.0",
"tslint": "^5.17.0",
"typescript": "^3.5.1",

@@ -34,0 +34,0 @@ "typescript-eslint-parser": "^22.0.0"

@@ -6,2 +6,6 @@ import makeLegalIdentifier from './makeLegalIdentifier';

function stringify(obj: any): string {
return (JSON.stringify(obj) || 'undefined').replace(/[\u2028\u2029]/g, char => `\\u${('000' + char.charCodeAt(0).toString(16)).slice(-4)}`);
}
function serializeArray<T>(arr: Array<T>, indent: Indent, baseIndent: string): string {

@@ -23,3 +27,3 @@ let output = '[';

const key = keys[i];
const stringKey = makeLegalIdentifier(key) === key ? key : JSON.stringify(key);
const stringKey = makeLegalIdentifier(key) === key ? key : stringify(key);
output += `${i > 0 ? ',' : ''}${separator}${stringKey}:${indent ? ' ' : ''}${serialize(

@@ -36,9 +40,11 @@ obj[key],

if (obj === Infinity) return 'Infinity';
if (obj === -Infinity) return '-Infinity';
if (obj === 0 && 1/obj === -Infinity) return '-0';
if (obj instanceof Date) return 'new Date(' + obj.getTime() + ')';
if (obj instanceof RegExp) return obj.toString();
if (typeof obj === 'number' && isNaN(obj)) return 'NaN';
if (obj !== obj) return 'NaN';
if (Array.isArray(obj)) return serializeArray(obj, indent, baseIndent);
if (obj === null) return 'null';
if (typeof obj === 'object') return serializeObject(obj, indent, baseIndent);
return JSON.stringify(obj);
return stringify(obj);
}

@@ -56,5 +62,10 @@

Array.isArray(data) ||
data instanceof Date ||
data instanceof RegExp ||
data === null
)
return `export default${_}${serialize(data, options.compact ? null : t, '')};`;
) {
const code = serialize(data, options.compact ? null : t, '');
const __ = _ || (/^[{[\-\/]/.test(code) ? '' : ' ');
return `export default${__}${code};`;
}

@@ -76,3 +87,3 @@ let namedExportCode = '';

defaultExportRows.push(
`${JSON.stringify(key)}: ${serialize(data[key], options.compact ? null : t, '')}`
`${stringify(key)}:${_}${serialize(data[key], options.compact ? null : t, '')}`
);

@@ -79,0 +90,0 @@ }

@@ -18,5 +18,5 @@ import { MakeLegalIdentifier } from './pluginutils';

return str;
return str || '_';
};
export { makeLegalIdentifier as default };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc