rollup-plugin-prettier
Advanced tools
Comparing version 2.3.0 to 3.0.0
@@ -35,8 +35,3 @@ /** | ||
function _interopDefaultLegacy(e) { | ||
return e && typeof e === "object" && "default" in e ? e : { default: e }; | ||
} | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
function _interopNamespaceDefault(e) { | ||
var n = Object.create(null); | ||
@@ -62,13 +57,7 @@ if (e) { | ||
} | ||
n["default"] = e; | ||
n.default = e; | ||
return Object.freeze(n); | ||
} | ||
var hasIn__default = /*#__PURE__*/ _interopDefaultLegacy(hasIn); | ||
var isEmpty__default = /*#__PURE__*/ _interopDefaultLegacy(isEmpty); | ||
var isNil__default = /*#__PURE__*/ _interopDefaultLegacy(isNil); | ||
var omitBy__default = /*#__PURE__*/ _interopDefaultLegacy(omitBy); | ||
var MagicString__default = /*#__PURE__*/ _interopDefaultLegacy(MagicString); | ||
var diff__namespace = /*#__PURE__*/ _interopNamespace(diff); | ||
var prettier__default = /*#__PURE__*/ _interopDefaultLegacy(prettier); | ||
var diff__namespace = /*#__PURE__*/ _interopNamespaceDefault(diff); | ||
@@ -97,14 +86,9 @@ /** | ||
// Initialize main options. | ||
this._options = omitBy__default["default"](options, (value, key) => | ||
OPTIONS.has(key) | ||
); | ||
this._options = omitBy(options, (value, key) => OPTIONS.has(key)); | ||
// 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) { | ||
const cwd = hasIn__default["default"](options, "cwd") | ||
? options.cwd | ||
: process.cwd(); | ||
const configOptions = | ||
prettier__default["default"].resolveConfig.sync(cwd); | ||
if (prettier.resolveConfig) { | ||
const cwd = hasIn(options, "cwd") ? options.cwd : process.cwd(); | ||
const configOptions = prettier.resolveConfig.sync(cwd); | ||
if (configOptions != null) { | ||
@@ -116,3 +100,3 @@ this._options = Object.assign(configOptions, this._options || {}); | ||
// Reset empty options. | ||
if (isEmpty__default["default"](this._options)) { | ||
if (isEmpty(this._options)) { | ||
this._options = undefined; | ||
@@ -122,3 +106,3 @@ } | ||
// Check if sourcemap is enabled by default. | ||
if (hasIn__default["default"](options, "sourcemap")) { | ||
if (hasIn(options, "sourcemap")) { | ||
this._sourcemap = options.sourcemap; | ||
@@ -156,3 +140,3 @@ } else { | ||
reformat(source, sourcemap) { | ||
const output = prettier__default["default"].format(source, this._options); | ||
const output = prettier.format(source, this._options); | ||
@@ -162,8 +146,4 @@ // Should we generate sourcemap? | ||
// Note that this option should be false by default as it may take a (very) long time. | ||
const defaultSourcemap = isNil__default["default"](this._sourcemap) | ||
? false | ||
: this._sourcemap; | ||
const outputSourcemap = isNil__default["default"](sourcemap) | ||
? defaultSourcemap | ||
: sourcemap; | ||
const defaultSourcemap = isNil(this._sourcemap) ? false : this._sourcemap; | ||
const outputSourcemap = isNil(sourcemap) ? defaultSourcemap : sourcemap; | ||
if (!outputSourcemap) { | ||
@@ -182,3 +162,3 @@ return { | ||
} | ||
const magicString = new MagicString__default["default"](source); | ||
const magicString = new MagicString(source); | ||
const changes = diff__namespace.diffChars(source, output); | ||
@@ -185,0 +165,0 @@ if (changes && changes.length > 0) { |
{ | ||
"name": "rollup-plugin-prettier", | ||
"version": "2.3.0", | ||
"version": "3.0.0", | ||
"description": "Run prettier formatter with rollup", | ||
@@ -32,3 +32,3 @@ "main": "dist/index.js", | ||
"prettier": "^1.0.0 || ^2.0.0", | ||
"rollup": "^1.0.0 || ^2.0.0" | ||
"rollup": "^1.0.0 || ^2.0.0 || ^3.0.0" | ||
}, | ||
@@ -69,4 +69,4 @@ "dependencies": { | ||
"rimraf": "3.0.2", | ||
"rollup": "2.79.1", | ||
"rollup-plugin-strip-banner": "2.1.0", | ||
"rollup": "3.2.3", | ||
"rollup-plugin-strip-banner": "3.0.0", | ||
"tmp": "0.2.1", | ||
@@ -73,0 +73,0 @@ "typescript": "4.8.4" |
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
134236
237