prettier 1.14.2 → 1.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +37 -33
- package/bin-prettier.js +30683 -24408
- package/index.js +24575 -17697
- package/package.json +1 -1
- package/parser-angular.js +1 -0
- package/parser-babylon.js +1 -1
- package/parser-flow.js +1 -1
- package/parser-glimmer.js +1 -1
- package/parser-html.js +1 -0
- package/parser-markdown.js +1 -1
- package/parser-postcss.js +23 -7
- package/parser-typescript.js +1 -1
- package/parser-yaml.js +1 -1
- package/standalone.js +23263 -14207
- package/third-party.js +186 -1
- package/parser-parse5.js +0 -1
- package/parser-vue.js +0 -1
package/parser-postcss.js
CHANGED
|
@@ -10437,7 +10437,8 @@ var DELIMITER_MAP = {
|
|
|
10437
10437
|
|
|
10438
10438
|
function parse(text) {
|
|
10439
10439
|
var delimiterRegex = Object.keys(DELIMITER_MAP).map(escape).join("|");
|
|
10440
|
-
var match = text.match(
|
|
10440
|
+
var match = text.match( // trailing spaces after delimiters are allowed
|
|
10441
|
+
new RegExp("^(".concat(delimiterRegex, ")[^\\n\\S]*\\n(?:([\\s\\S]*?)\\n)?\\1[^\\n\\S]*(\\n|$)")));
|
|
10441
10442
|
|
|
10442
10443
|
if (match === null) {
|
|
10443
10444
|
return {
|
|
@@ -10446,7 +10447,7 @@ function parse(text) {
|
|
|
10446
10447
|
};
|
|
10447
10448
|
}
|
|
10448
10449
|
|
|
10449
|
-
var raw = match[0].
|
|
10450
|
+
var raw = match[0].replace(/\n$/, "");
|
|
10450
10451
|
var delimiter = match[1];
|
|
10451
10452
|
var value = match[2];
|
|
10452
10453
|
return {
|
|
@@ -10455,7 +10456,7 @@ function parse(text) {
|
|
|
10455
10456
|
value: value,
|
|
10456
10457
|
raw: raw
|
|
10457
10458
|
},
|
|
10458
|
-
content: text.slice(
|
|
10459
|
+
content: match[0].replace(/[^\n]/g, " ") + text.slice(match[0].length)
|
|
10459
10460
|
};
|
|
10460
10461
|
}
|
|
10461
10462
|
|
|
@@ -19065,7 +19066,7 @@ var parser = {
|
|
|
19065
19066
|
node = endNode;
|
|
19066
19067
|
}
|
|
19067
19068
|
|
|
19068
|
-
if (node.source) {
|
|
19069
|
+
if (node.source && node.source.end) {
|
|
19069
19070
|
return lineColumnToIndex(node.source.end, node.source.input.css);
|
|
19070
19071
|
}
|
|
19071
19072
|
|
|
@@ -19169,7 +19170,8 @@ function insertPragma(text) {
|
|
|
19169
19170
|
pragmas: pragmas,
|
|
19170
19171
|
comments: parsedDocblock.comments.replace(/^(\s+?\r?\n)+/, "") // remove leading newlines
|
|
19171
19172
|
|
|
19172
|
-
});
|
|
19173
|
+
}).replace(/(\r\n|\r)/g, "\n"); // normalise newlines (mitigate use of os.EOL by jest-docblock)
|
|
19174
|
+
|
|
19173
19175
|
var strippedText = docblock.strip(text);
|
|
19174
19176
|
var separatingNewlines = strippedText.startsWith("\n") ? "\n" : "\n\n";
|
|
19175
19177
|
return newDocblock + separatingNewlines + strippedText;
|
|
@@ -19582,6 +19584,14 @@ function isDetachedRulesetCallNode(node) {
|
|
|
19582
19584
|
return node.raws && node.raws.params && /^\(\s*\)$/.test(node.raws.params);
|
|
19583
19585
|
}
|
|
19584
19586
|
|
|
19587
|
+
function isTemplatePlaceholderNode(node) {
|
|
19588
|
+
return node.name.startsWith("prettier-placeholder");
|
|
19589
|
+
}
|
|
19590
|
+
|
|
19591
|
+
function isTemplatePropNode(node) {
|
|
19592
|
+
return node.prop.startsWith("@prettier-placeholder");
|
|
19593
|
+
}
|
|
19594
|
+
|
|
19585
19595
|
function isPostcssSimpleVarNode(currentNode, nextNode) {
|
|
19586
19596
|
return currentNode.value === "$$" && currentNode.type === "value-func" && nextNode && nextNode.type === "value-word" && !nextNode.raws.before;
|
|
19587
19597
|
}
|
|
@@ -19707,6 +19717,8 @@ module.exports = {
|
|
|
19707
19717
|
hasEmptyRawBefore: hasEmptyRawBefore,
|
|
19708
19718
|
isSCSSNestedPropertyNode: isSCSSNestedPropertyNode,
|
|
19709
19719
|
isDetachedRulesetCallNode: isDetachedRulesetCallNode,
|
|
19720
|
+
isTemplatePlaceholderNode: isTemplatePlaceholderNode,
|
|
19721
|
+
isTemplatePropNode: isTemplatePropNode,
|
|
19710
19722
|
isPostcssSimpleVarNode: isPostcssSimpleVarNode,
|
|
19711
19723
|
isKeyValuePairNode: isKeyValuePairNode,
|
|
19712
19724
|
isKeyValuePairInParenGroupNode: isKeyValuePairInParenGroupNode,
|
|
@@ -21571,12 +21583,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
21571
21583
|
|
|
21572
21584
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21573
21585
|
|
|
21574
|
-
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null) return
|
|
21586
|
+
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
21575
21587
|
|
|
21576
21588
|
function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
21577
21589
|
|
|
21578
21590
|
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
21579
21591
|
|
|
21592
|
+
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
21593
|
+
|
|
21580
21594
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21581
21595
|
|
|
21582
21596
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
@@ -21626,12 +21640,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
21626
21640
|
|
|
21627
21641
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21628
21642
|
|
|
21629
|
-
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null) return
|
|
21643
|
+
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
21630
21644
|
|
|
21631
21645
|
function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
21632
21646
|
|
|
21633
21647
|
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
21634
21648
|
|
|
21649
|
+
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
21650
|
+
|
|
21635
21651
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21636
21652
|
|
|
21637
21653
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|