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

rollup-plugin-prettier

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-prettier - npm Package Compare versions

Comparing version 2.2.2 to 2.3.0

39

dist/index.js
/**
* The MIT License (MIT)
*
* Copyright (c) 2017-2020 Mickael Jeanroy
* Copyright (c) 2017-2022 Mickael Jeanroy
*

@@ -77,4 +77,4 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy

*/
const OPTIONS = new Set(["sourcemap", "cwd"]);
const OPTIONS = new Set(["sourcemap", "cwd"]);
/**

@@ -85,3 +85,2 @@ * The plugin.

*/
class RollupPluginPrettier {

@@ -95,9 +94,11 @@ /**

// Initialize plugin name.
this.name = "rollup-plugin-prettier"; // Initialize main options.
this.name = "rollup-plugin-prettier";
// Initialize main options.
this._options = omitBy__default["default"](options, (value, key) =>
OPTIONS.has(key)
); // Try to resolve config file it it exists
);
// Try to resolve config file it it exists
// Be careful, `resolveConfig` function does not exist on old version of prettier.
if (prettier__default["default"].resolveConfig) {

@@ -109,12 +110,13 @@ const cwd = hasIn__default["default"](options, "cwd")

prettier__default["default"].resolveConfig.sync(cwd);
if (configOptions != null) {
this._options = Object.assign(configOptions, this._options || {});
}
} // Reset empty options.
}
// Reset empty options.
if (isEmpty__default["default"](this._options)) {
this._options = undefined;
} // Check if sourcemap is enabled by default.
}
// Check if sourcemap is enabled by default.
if (hasIn__default["default"](options, "sourcemap")) {

@@ -126,2 +128,3 @@ this._sourcemap = options.sourcemap;

}
/**

@@ -132,6 +135,6 @@ * Get the `sourcemap` value.

*/
getSourcemap() {
return this._sourcemap;
}
/**

@@ -142,6 +145,6 @@ * Disable sourcemap.

*/
enableSourcemap() {
this._sourcemap = true;
}
/**

@@ -154,8 +157,8 @@ * Reformat source code using prettier.

*/
reformat(source, sourcemap) {
const output = prettier__default["default"].format(source, this._options);
reformat(source, sourcemap) {
const output = prettier__default["default"].format(source, this._options); // Should we generate sourcemap?
// Should we generate sourcemap?
// The sourcemap option may be a boolean or any truthy value (such as a `string`).
// Note that this option should be false by default as it may take a (very) long time.
const defaultSourcemap = isNil__default["default"](this._sourcemap)

@@ -167,3 +170,2 @@ ? false

: sourcemap;
if (!outputSourcemap) {

@@ -174,3 +176,2 @@ return {

}
if (defaultSourcemap !== "silent") {

@@ -184,6 +185,4 @@ console.warn(

}
const magicString = new MagicString__default["default"](source);
const changes = diff__namespace.diffChars(source, output);
if (changes && changes.length > 0) {

@@ -198,7 +197,5 @@ let idx = 0;

}
idx += part.count;
});
}
return {

@@ -219,3 +216,2 @@ code: magicString.toString(),

*/
function rollupPluginPrettier(options) {

@@ -229,3 +225,2 @@ const plugin = new RollupPluginPrettier(options);

name: plugin.name,
/**

@@ -232,0 +227,0 @@ * Function called by `rollup` before generating final bundle.

{
"name": "rollup-plugin-prettier",
"version": "2.2.2",
"version": "2.3.0",
"description": "Run prettier formatter with rollup",

@@ -36,3 +36,3 @@ "main": "dist/index.js",

"@types/prettier": "^1.0.0 || ^2.0.0",
"diff": "5.0.0",
"diff": "5.1.0",
"lodash.hasin": "4.5.2",

@@ -42,17 +42,17 @@ "lodash.isempty": "4.4.0",

"lodash.omitby": "4.6.0",
"magic-string": "0.25.7"
"magic-string": "0.26.7"
},
"devDependencies": {
"@babel/core": "7.16.7",
"@babel/parser": "7.16.7",
"@babel/preset-env": "7.16.7",
"@babel/register": "7.16.7",
"@rollup/plugin-babel": "5.3.0",
"@typescript-eslint/eslint-plugin": "5.9.0",
"@typescript-eslint/parser": "5.9.0",
"@babel/core": "7.19.6",
"@babel/parser": "7.19.6",
"@babel/preset-env": "7.19.4",
"@babel/register": "7.18.9",
"@rollup/plugin-babel": "6.0.2",
"@typescript-eslint/eslint-plugin": "5.41.0",
"@typescript-eslint/parser": "5.41.0",
"babel-plugin-add-module-exports": "1.0.4",
"eslint": "8.6.0",
"eslint": "8.26.0",
"eslint-config-google": "0.14.0",
"fancy-log": "1.3.3",
"globalthis": "1.0.2",
"fancy-log": "2.0.0",
"globalthis": "1.0.3",
"gulp": "4.0.2",

@@ -67,10 +67,9 @@ "gulp-bump": "3.2.0",

"lodash.startswith": "4.2.1",
"prettier": "2.5.1",
"prettier": "2.7.1",
"q": "1.5.1",
"rimraf": "3.0.2",
"rollup": "2.62.0",
"rollup-plugin-license": "2.6.1",
"rollup-plugin-strip-banner": "2.0.0",
"rollup": "2.79.1",
"rollup-plugin-strip-banner": "2.1.0",
"tmp": "0.2.1",
"typescript": "4.5.4"
"typescript": "4.8.4"
},

@@ -77,0 +76,0 @@ "engines": {

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

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