Socket
Socket
Sign inDemoInstall

@rollup/plugin-json

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rollup/plugin-json - npm Package Compare versions

Comparing version 4.0.3 to 4.1.0

8

CHANGELOG.md
# @rollup/plugin-json ChangeLog
## v4.1.0
_2020-06-05_
### Features
- feat: log the filename when JSON.parse fails (#417)
## v4.0.3

@@ -4,0 +12,0 @@

26

dist/index.es.js

@@ -16,11 +16,19 @@ import { createFilter, dataToEsm } from '@rollup/pluginutils';

return {
code: dataToEsm(JSON.parse(json), {
preferConst: options.preferConst,
compact: options.compact,
namedExports: options.namedExports,
indent: indent
}),
map: { mappings: '' }
};
try {
var parsed = JSON.parse(json);
return {
code: dataToEsm(parsed, {
preferConst: options.preferConst,
compact: options.compact,
namedExports: options.namedExports,
indent: indent
}),
map: { mappings: '' }
};
} catch (err) {
var message = 'Could not parse JSON file';
var position = parseInt(/[\d]/.exec(err.message)[0], 10);
this.warn({ message: message, id: id, position: position });
return null;
}
}

@@ -27,0 +35,0 @@ };

@@ -18,11 +18,19 @@ 'use strict';

return {
code: pluginutils.dataToEsm(JSON.parse(json), {
preferConst: options.preferConst,
compact: options.compact,
namedExports: options.namedExports,
indent: indent
}),
map: { mappings: '' }
};
try {
var parsed = JSON.parse(json);
return {
code: pluginutils.dataToEsm(parsed, {
preferConst: options.preferConst,
compact: options.compact,
namedExports: options.namedExports,
indent: indent
}),
map: { mappings: '' }
};
} catch (err) {
var message = 'Could not parse JSON file';
var position = parseInt(/[\d]/.exec(err.message)[0], 10);
this.warn({ message: message, id: id, position: position });
return null;
}
}

@@ -29,0 +37,0 @@ };

{
"name": "@rollup/plugin-json",
"version": "4.0.3",
"version": "4.1.0",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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