prettier 1.13.3 → 1.13.7
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/README.md +10 -3
- package/bin-prettier.js +156 -56
- package/index.js +155 -55
- package/package.json +5 -2
- package/parser-flow.js +1 -1
- package/parser-postcss.js +15 -12
- package/parser-typescript.js +1 -1
- package/standalone.js +58 -30
- package/prettier-1.13.3.tgz +0 -0
package/README.md
CHANGED
|
@@ -22,18 +22,22 @@
|
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
25
|
-
<a href="https://gitter.im/jlongster/prettier">
|
|
26
|
-
<img alt="Chat on Gitter" src="https://img.shields.io/gitter/room/jlongster/prettier.svg?style=flat-square">
|
|
27
|
-
</a>
|
|
28
25
|
<a href="https://travis-ci.org/prettier/prettier">
|
|
29
26
|
<img alt="Travis CI Build Status" src="https://img.shields.io/travis/prettier/prettier/master.svg?style=flat-square&label=Travis+CI">
|
|
30
27
|
</a>
|
|
31
28
|
<a href="https://circleci.com/gh/prettier/prettier">
|
|
32
29
|
<img alt="CircleCI Build Status" src="https://img.shields.io/circleci/project/github/prettier/prettier/master.svg?style=flat-square&label=CircleCI">
|
|
33
30
|
</a>
|
|
31
|
+
<a href="https://ci.appveyor.com/project/azz/prettier">
|
|
32
|
+
<img alt="AppVeyor Build Status" src="https://img.shields.io/appveyor/ci/azz/prettier.svg?style=flat-square&label=AppVeyor">
|
|
33
|
+
</a>
|
|
34
34
|
<a href="https://codecov.io/gh/prettier/prettier">
|
|
35
35
|
<img alt="Codecov Coverage Status" src="https://img.shields.io/codecov/c/github/prettier/prettier.svg?style=flat-square">
|
|
36
36
|
</a>
|
|
37
|
+
<a href="https://twitter.com/acdlite/status/974390255393505280">
|
|
38
|
+
<img alt="Blazing Fast" src="https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg?style=flat-square">
|
|
39
|
+
</a>
|
|
40
|
+
<br/>
|
|
37
41
|
<a href="https://www.npmjs.com/package/prettier">
|
|
38
42
|
<img alt="npm version" src="https://img.shields.io/npm/v/prettier.svg?style=flat-square">
|
|
39
43
|
</a>
|
|
@@ -43,6 +47,9 @@
|
|
|
43
47
|
<a href="#badge">
|
|
44
48
|
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square">
|
|
45
49
|
</a>
|
|
50
|
+
<a href="https://gitter.im/jlongster/prettier">
|
|
51
|
+
<img alt="Chat on Gitter" src="https://img.shields.io/gitter/room/jlongster/prettier.svg?style=flat-square">
|
|
52
|
+
</a>
|
|
46
53
|
<a href="https://twitter.com/PrettierCode">
|
|
47
54
|
<img alt="Follow Prettier on Twitter" src="https://img.shields.io/twitter/follow/prettiercode.svg?label=follow+prettier&style=flat-square">
|
|
48
55
|
</a>
|
package/bin-prettier.js
CHANGED
|
@@ -14,7 +14,7 @@ var thirdParty__default = thirdParty['default'];
|
|
|
14
14
|
var readline = _interopDefault(require('readline'));
|
|
15
15
|
|
|
16
16
|
var name = "prettier";
|
|
17
|
-
var version$1 = "1.13.
|
|
17
|
+
var version$1 = "1.13.7";
|
|
18
18
|
var description = "Prettier is an opinionated code formatter";
|
|
19
19
|
var bin = {
|
|
20
20
|
"prettier": "./bin/prettier.js"
|
|
@@ -45,7 +45,7 @@ var dependencies = {
|
|
|
45
45
|
"esutils": "2.0.2",
|
|
46
46
|
"find-parent-dir": "0.3.0",
|
|
47
47
|
"find-project-root": "1.1.1",
|
|
48
|
-
"flow-parser": "0.
|
|
48
|
+
"flow-parser": "0.75.0",
|
|
49
49
|
"get-stream": "3.0.0",
|
|
50
50
|
"globby": "6.1.0",
|
|
51
51
|
"graphql": "0.13.2",
|
|
@@ -69,7 +69,7 @@ var dependencies = {
|
|
|
69
69
|
"semver": "5.4.1",
|
|
70
70
|
"string-width": "2.1.1",
|
|
71
71
|
"typescript": "2.9.0-dev.20180421",
|
|
72
|
-
"typescript-eslint-parser": "
|
|
72
|
+
"typescript-eslint-parser": "16.0.0",
|
|
73
73
|
"unicode-regex": "1.0.1",
|
|
74
74
|
"unified": "6.1.6"
|
|
75
75
|
};
|
|
@@ -88,7 +88,7 @@ var devDependencies = {
|
|
|
88
88
|
"eslint-plugin-react": "7.7.0",
|
|
89
89
|
"jest": "21.1.0",
|
|
90
90
|
"mkdirp": "0.5.1",
|
|
91
|
-
"prettier": "1.13.
|
|
91
|
+
"prettier": "1.13.4",
|
|
92
92
|
"prettylint": "1.0.0",
|
|
93
93
|
"rimraf": "2.6.2",
|
|
94
94
|
"rollup": "0.47.6",
|
|
@@ -6964,7 +6964,7 @@ function resolveParser$1(opts, parsers) {
|
|
|
6964
6964
|
|
|
6965
6965
|
try {
|
|
6966
6966
|
return {
|
|
6967
|
-
parse:
|
|
6967
|
+
parse: require(path.resolve(process.cwd(), opts.parser)),
|
|
6968
6968
|
astFormat: "estree",
|
|
6969
6969
|
locStart,
|
|
6970
6970
|
locEnd
|
|
@@ -8829,8 +8829,7 @@ function printDocToString$1(doc, options) {
|
|
|
8829
8829
|
out.pop();
|
|
8830
8830
|
}
|
|
8831
8831
|
|
|
8832
|
-
if (out.length && typeof out[out.length - 1] === "string"
|
|
8833
|
-
!/\S {2}$/.test(out[out.length - 1]))) {
|
|
8832
|
+
if (out.length && typeof out[out.length - 1] === "string") {
|
|
8834
8833
|
out[out.length - 1] = out[out.length - 1].replace(/[^\S\n]*$/, "");
|
|
8835
8834
|
}
|
|
8836
8835
|
}
|
|
@@ -10188,6 +10187,13 @@ function attachComments(text, ast, opts) {
|
|
|
10188
10187
|
}
|
|
10189
10188
|
|
|
10190
10189
|
function coreFormat(text, opts, addAlignmentSize) {
|
|
10190
|
+
if (!text || !text.trim().length) {
|
|
10191
|
+
return {
|
|
10192
|
+
formatted: "",
|
|
10193
|
+
cursorOffset: 0
|
|
10194
|
+
};
|
|
10195
|
+
}
|
|
10196
|
+
|
|
10191
10197
|
addAlignmentSize = addAlignmentSize || 0;
|
|
10192
10198
|
var parsed = parser.parse(text, opts);
|
|
10193
10199
|
var ast = parsed.ast;
|
|
@@ -10778,22 +10784,76 @@ typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32
|
|
|
10778
10784
|
};
|
|
10779
10785
|
}
|
|
10780
10786
|
|
|
10781
|
-
|
|
10782
|
-
|
|
10787
|
+
/**
|
|
10788
|
+
* @param {string} filename
|
|
10789
|
+
* @returns {Promise<null | string>}
|
|
10790
|
+
*/
|
|
10783
10791
|
|
|
10784
|
-
if (ignorePath) {
|
|
10785
|
-
var resolvedIgnorePath = path.resolve(ignorePath);
|
|
10786
10792
|
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
if (
|
|
10791
|
-
|
|
10793
|
+
function getFileContentOrNull(filename) {
|
|
10794
|
+
return new Promise(function (resolve, reject) {
|
|
10795
|
+
fs.readFile(filename, "utf8", function (error, data) {
|
|
10796
|
+
if (error && error.code !== "ENOENT") {
|
|
10797
|
+
reject(createError(filename, error));
|
|
10798
|
+
} else {
|
|
10799
|
+
resolve(error ? null : data);
|
|
10792
10800
|
}
|
|
10801
|
+
});
|
|
10802
|
+
});
|
|
10803
|
+
}
|
|
10804
|
+
/**
|
|
10805
|
+
* @param {string} filename
|
|
10806
|
+
* @returns {null | string}
|
|
10807
|
+
*/
|
|
10808
|
+
|
|
10809
|
+
|
|
10810
|
+
getFileContentOrNull.sync = function (filename) {
|
|
10811
|
+
try {
|
|
10812
|
+
return fs.readFileSync(filename, "utf8");
|
|
10813
|
+
} catch (error) {
|
|
10814
|
+
if (error && error.code === "ENOENT") {
|
|
10815
|
+
return null;
|
|
10793
10816
|
}
|
|
10817
|
+
|
|
10818
|
+
throw createError(filename, error);
|
|
10794
10819
|
}
|
|
10820
|
+
};
|
|
10821
|
+
|
|
10822
|
+
function createError(filename, error) {
|
|
10823
|
+
return new Error(`Unable to read ${filename}: ${error.message}`);
|
|
10824
|
+
}
|
|
10825
|
+
|
|
10826
|
+
var getFileContentOrNull_1 = getFileContentOrNull;
|
|
10827
|
+
|
|
10828
|
+
/**
|
|
10829
|
+
* @param {undefined | string} ignorePath
|
|
10830
|
+
* @param {undefined | boolean} withNodeModules
|
|
10831
|
+
*/
|
|
10832
|
+
|
|
10833
|
+
|
|
10834
|
+
function createIgnorer(ignorePath, withNodeModules) {
|
|
10835
|
+
return (!ignorePath ? Promise.resolve(null) : getFileContentOrNull_1(path.resolve(ignorePath))).then(function (ignoreContent) {
|
|
10836
|
+
return _createIgnorer(ignoreContent, withNodeModules);
|
|
10837
|
+
});
|
|
10838
|
+
}
|
|
10839
|
+
/**
|
|
10840
|
+
* @param {undefined | string} ignorePath
|
|
10841
|
+
* @param {undefined | boolean} withNodeModules
|
|
10842
|
+
*/
|
|
10843
|
+
|
|
10844
|
+
|
|
10845
|
+
createIgnorer.sync = function (ignorePath, withNodeModules) {
|
|
10846
|
+
var ignoreContent = !ignorePath ? null : getFileContentOrNull_1.sync(path.resolve(ignorePath));
|
|
10847
|
+
return _createIgnorer(ignoreContent, withNodeModules);
|
|
10848
|
+
};
|
|
10849
|
+
/**
|
|
10850
|
+
* @param {null | string} ignoreContent
|
|
10851
|
+
* @param {undefined | boolean} withNodeModules
|
|
10852
|
+
*/
|
|
10795
10853
|
|
|
10796
|
-
|
|
10854
|
+
|
|
10855
|
+
function _createIgnorer(ignoreContent, withNodeModules) {
|
|
10856
|
+
var ignorer = ignore().add(ignoreContent || "");
|
|
10797
10857
|
|
|
10798
10858
|
if (!withNodeModules) {
|
|
10799
10859
|
ignorer.add("node_modules");
|
|
@@ -10804,9 +10864,15 @@ function createIgnorer(ignorePath, withNodeModules) {
|
|
|
10804
10864
|
|
|
10805
10865
|
var createIgnorer_1 = createIgnorer;
|
|
10806
10866
|
|
|
10867
|
+
/**
|
|
10868
|
+
* @typedef {{ ignorePath?: string, withNodeModules?: boolean, plugins: object }} FileInfoOptions
|
|
10869
|
+
* @typedef {{ ignored: boolean, inferredParser: string | null }} FileInfoResult
|
|
10870
|
+
*/
|
|
10871
|
+
|
|
10807
10872
|
/**
|
|
10808
10873
|
* @param {string} filePath
|
|
10809
|
-
* @param {
|
|
10874
|
+
* @param {FileInfoOptions} opts
|
|
10875
|
+
* @returns {Promise<FileInfoResult>}
|
|
10810
10876
|
*
|
|
10811
10877
|
* Please note that prettier.getFileInfo() expects opts.plugins to be an array of paths,
|
|
10812
10878
|
* not an object. A transformation from this array to an object is automatically done
|
|
@@ -10814,25 +10880,32 @@ var createIgnorer_1 = createIgnorer;
|
|
|
10814
10880
|
*/
|
|
10815
10881
|
|
|
10816
10882
|
|
|
10817
|
-
function
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10883
|
+
function getFileInfo(filePath, opts) {
|
|
10884
|
+
return createIgnorer_1(opts.ignorePath, opts.withNodeModules).then(function (ignorer) {
|
|
10885
|
+
return _getFileInfo(ignorer, filePath, opts.plugins);
|
|
10886
|
+
});
|
|
10887
|
+
}
|
|
10888
|
+
/**
|
|
10889
|
+
* @param {string} filePath
|
|
10890
|
+
* @param {FileInfoOptions} opts
|
|
10891
|
+
* @returns {FileInfoResult}
|
|
10892
|
+
*/
|
|
10893
|
+
|
|
10894
|
+
|
|
10895
|
+
getFileInfo.sync = function (filePath, opts) {
|
|
10896
|
+
var ignorer = createIgnorer_1.sync(opts.ignorePath, opts.withNodeModules);
|
|
10897
|
+
return _getFileInfo(ignorer, filePath, opts.plugins);
|
|
10898
|
+
};
|
|
10899
|
+
|
|
10900
|
+
function _getFileInfo(ignorer, filePath, plugins) {
|
|
10901
|
+
var ignored = ignorer.ignores(filePath);
|
|
10902
|
+
var inferredParser = options.inferParser(filePath, plugins) || null;
|
|
10822
10903
|
return {
|
|
10823
10904
|
ignored,
|
|
10824
10905
|
inferredParser
|
|
10825
10906
|
};
|
|
10826
|
-
} // the method has been implemented as asynchronous to avoid possible breaking changes in future
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
function getFileInfo(filePath, opts) {
|
|
10830
|
-
return Promise.resolve().then(function () {
|
|
10831
|
-
return _getFileInfo(filePath, opts);
|
|
10832
|
-
});
|
|
10833
10907
|
}
|
|
10834
10908
|
|
|
10835
|
-
getFileInfo.sync = _getFileInfo;
|
|
10836
10909
|
var getFileInfo_1 = getFileInfo;
|
|
10837
10910
|
|
|
10838
10911
|
var lodash_uniqby = createCommonjsModule(function (module, exports) {
|
|
@@ -18725,12 +18798,22 @@ var comments$3 = {
|
|
|
18725
18798
|
isBlockComment
|
|
18726
18799
|
};
|
|
18727
18800
|
|
|
18728
|
-
function hasClosureCompilerTypeCastComment(text,
|
|
18801
|
+
function hasClosureCompilerTypeCastComment(text, path$$1, locStart, locEnd) {
|
|
18729
18802
|
// https://github.com/google/closure-compiler/wiki/Annotating-Types#type-casts
|
|
18730
18803
|
// Syntax example: var x = /** @type {string} */ (fruit);
|
|
18731
|
-
|
|
18732
|
-
|
|
18733
|
-
|
|
18804
|
+
var n = path$$1.getValue();
|
|
18805
|
+
return util$1.getNextNonSpaceNonCommentCharacter(text, n, locEnd) === ")" && (hasTypeCastComment(n) || hasAncestorTypeCastComment(0)); // for sub-item: /** @type {array} */ (numberOrString).map(x => x);
|
|
18806
|
+
|
|
18807
|
+
function hasAncestorTypeCastComment(index) {
|
|
18808
|
+
var ancestor = path$$1.getParentNode(index);
|
|
18809
|
+
return ancestor && util$1.getNextNonSpaceNonCommentCharacter(text, ancestor, locEnd) !== ")" && /^[\s(]*$/.test(text.slice(locStart(ancestor), locStart(n))) ? hasTypeCastComment(ancestor) || hasAncestorTypeCastComment(index + 1) : false;
|
|
18810
|
+
}
|
|
18811
|
+
|
|
18812
|
+
function hasTypeCastComment(node) {
|
|
18813
|
+
return node.comments && node.comments.some(function (comment) {
|
|
18814
|
+
return comment.leading && comments$3.isBlockComment(comment) && comment.value.match(/^\*\s*@type\s*{[^}]+}\s*$/) && util$1.getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === "(";
|
|
18815
|
+
});
|
|
18816
|
+
}
|
|
18734
18817
|
}
|
|
18735
18818
|
|
|
18736
18819
|
function needsParens(path$$1, options) {
|
|
@@ -18756,7 +18839,7 @@ function needsParens(path$$1, options) {
|
|
|
18756
18839
|
// parentheses.
|
|
18757
18840
|
|
|
18758
18841
|
|
|
18759
|
-
if (hasClosureCompilerTypeCastComment(options.originalText,
|
|
18842
|
+
if (hasClosureCompilerTypeCastComment(options.originalText, path$$1, options.locStart, options.locEnd)) {
|
|
18760
18843
|
return true;
|
|
18761
18844
|
} // Identifiers never need parentheses.
|
|
18762
18845
|
|
|
@@ -20901,7 +20984,6 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
20901
20984
|
|
|
20902
20985
|
case "DeclareInterface":
|
|
20903
20986
|
case "InterfaceDeclaration":
|
|
20904
|
-
case "InterfaceType":
|
|
20905
20987
|
case "InterfaceTypeAnnotation":
|
|
20906
20988
|
{
|
|
20907
20989
|
if (n.type === "DeclareInterface" || isNodeStartingWithDeclare(n, options)) {
|
|
@@ -21306,7 +21388,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
21306
21388
|
|
|
21307
21389
|
case "TSLastTypeNode":
|
|
21308
21390
|
// TSImportType
|
|
21309
|
-
return concat$4([!n.isTypeOf ? "" : "typeof ", "import(", path$$1.call(print, "argument"), ")", !n.qualifier ? "" : concat$4([".", path$$1.call(print, "qualifier")])]);
|
|
21391
|
+
return concat$4([!n.isTypeOf ? "" : "typeof ", "import(", path$$1.call(print, "argument"), ")", !n.qualifier ? "" : concat$4([".", path$$1.call(print, "qualifier")]), printTypeParameters(path$$1, options, print, "typeParameters")]);
|
|
21310
21392
|
|
|
21311
21393
|
case "TSLiteralType":
|
|
21312
21394
|
return path$$1.call(print, "literal");
|
|
@@ -22362,12 +22444,13 @@ function printMemberChain(path$$1, options, print) {
|
|
|
22362
22444
|
// .map(x => x)
|
|
22363
22445
|
//
|
|
22364
22446
|
// In order to detect those cases, we use an heuristic: if the first
|
|
22365
|
-
// node is an identifier with the name starting with a capital
|
|
22366
|
-
// The rationale is that they are
|
|
22447
|
+
// node is an identifier with the name starting with a capital
|
|
22448
|
+
// letter or just a sequence of _$. The rationale is that they are
|
|
22449
|
+
// likely to be factories.
|
|
22367
22450
|
|
|
22368
22451
|
|
|
22369
22452
|
function isFactory(name) {
|
|
22370
|
-
return /^[A-Z]
|
|
22453
|
+
return /^[A-Z]|^[_$]+$/.test(name);
|
|
22371
22454
|
} // In case the Identifier is shorter than tab width, we can keep the
|
|
22372
22455
|
// first call in a single line, if it's an ExpressionStatement.
|
|
22373
22456
|
//
|
|
@@ -23509,6 +23592,10 @@ function genericPrint$2(path$$1, options, print) {
|
|
|
23509
23592
|
|
|
23510
23593
|
case "Identifier":
|
|
23511
23594
|
return JSON.stringify(node.name);
|
|
23595
|
+
|
|
23596
|
+
default:
|
|
23597
|
+
/* istanbul ignore next */
|
|
23598
|
+
throw new Error("unknown type: " + JSON.stringify(node.type));
|
|
23512
23599
|
}
|
|
23513
23600
|
}
|
|
23514
23601
|
|
|
@@ -25141,13 +25228,16 @@ function genericPrint$4(path$$1, options, print) {
|
|
|
25141
25228
|
var parts = [];
|
|
25142
25229
|
path$$1.map(function (pathChild, index) {
|
|
25143
25230
|
parts.push(concat$9([pathChild.call(print)]));
|
|
25144
|
-
parts.push(hardline$8);
|
|
25145
25231
|
|
|
25146
|
-
if (index !== n.definitions.length - 1
|
|
25232
|
+
if (index !== n.definitions.length - 1) {
|
|
25147
25233
|
parts.push(hardline$8);
|
|
25234
|
+
|
|
25235
|
+
if (isNextLineEmpty$4(options.originalText, pathChild.getValue(), options)) {
|
|
25236
|
+
parts.push(hardline$8);
|
|
25237
|
+
}
|
|
25148
25238
|
}
|
|
25149
25239
|
}, "definitions");
|
|
25150
|
-
return concat$9(parts, hardline$8);
|
|
25240
|
+
return concat$9([concat$9(parts), hardline$8]);
|
|
25151
25241
|
}
|
|
25152
25242
|
|
|
25153
25243
|
case "OperationDefinition":
|
|
@@ -25452,9 +25542,9 @@ var languageGraphql = {
|
|
|
25452
25542
|
|
|
25453
25543
|
var _require$$0$builders$6 = doc.builders;
|
|
25454
25544
|
var hardline$10 = _require$$0$builders$6.hardline;
|
|
25455
|
-
var literalline$
|
|
25545
|
+
var literalline$4 = _require$$0$builders$6.literalline;
|
|
25456
25546
|
var concat$11 = _require$$0$builders$6.concat;
|
|
25457
|
-
var markAsRoot$
|
|
25547
|
+
var markAsRoot$2 = _require$$0$builders$6.markAsRoot;
|
|
25458
25548
|
var mapDoc$4 = doc.utils.mapDoc;
|
|
25459
25549
|
|
|
25460
25550
|
function embed$2(path$$1, print, textToDoc, options) {
|
|
@@ -25471,7 +25561,7 @@ function embed$2(path$$1, print, textToDoc, options) {
|
|
|
25471
25561
|
var doc$$2 = textToDoc(node.value, {
|
|
25472
25562
|
parser
|
|
25473
25563
|
});
|
|
25474
|
-
return markAsRoot$
|
|
25564
|
+
return markAsRoot$2(concat$11([style, node.lang, hardline$10, replaceNewlinesWithLiterallines(doc$$2), style]));
|
|
25475
25565
|
}
|
|
25476
25566
|
}
|
|
25477
25567
|
|
|
@@ -25497,7 +25587,7 @@ function embed$2(path$$1, print, textToDoc, options) {
|
|
|
25497
25587
|
function replaceNewlinesWithLiterallines(doc$$2) {
|
|
25498
25588
|
return mapDoc$4(doc$$2, function (currentDoc) {
|
|
25499
25589
|
return typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$11(currentDoc.split(/(\n)/g).map(function (v, i) {
|
|
25500
|
-
return i % 2 === 0 ? v : literalline$
|
|
25590
|
+
return i % 2 === 0 ? v : literalline$4;
|
|
25501
25591
|
})) : currentDoc;
|
|
25502
25592
|
});
|
|
25503
25593
|
}
|
|
@@ -25561,6 +25651,8 @@ var _require$$0$builders$5 = doc.builders;
|
|
|
25561
25651
|
var concat$10 = _require$$0$builders$5.concat;
|
|
25562
25652
|
var join$8 = _require$$0$builders$5.join;
|
|
25563
25653
|
var line$7 = _require$$0$builders$5.line;
|
|
25654
|
+
var literalline$3 = _require$$0$builders$5.literalline;
|
|
25655
|
+
var markAsRoot$1 = _require$$0$builders$5.markAsRoot;
|
|
25564
25656
|
var hardline$9 = _require$$0$builders$5.hardline;
|
|
25565
25657
|
var softline$6 = _require$$0$builders$5.softline;
|
|
25566
25658
|
var fill$4 = _require$$0$builders$5.fill;
|
|
@@ -25693,7 +25785,9 @@ function genericPrint$5(path$$1, options, print) {
|
|
|
25693
25785
|
{
|
|
25694
25786
|
var _parentNode2 = path$$1.getParentNode();
|
|
25695
25787
|
|
|
25696
|
-
|
|
25788
|
+
var value = _parentNode2.type === "root" && util$1.getLast(_parentNode2.children) === node ? node.value.trimRight() : node.value;
|
|
25789
|
+
var isHtmlComment = /^<!--[\s\S]*-->$/.test(value);
|
|
25790
|
+
return replaceNewlinesWith(value, isHtmlComment ? hardline$9 : markAsRoot$1(literalline$3));
|
|
25697
25791
|
}
|
|
25698
25792
|
|
|
25699
25793
|
case "list":
|
|
@@ -25771,10 +25865,10 @@ function genericPrint$5(path$$1, options, print) {
|
|
|
25771
25865
|
return printChildren(path$$1, options, print);
|
|
25772
25866
|
|
|
25773
25867
|
case "break":
|
|
25774
|
-
return
|
|
25868
|
+
return /\s/.test(options.originalText[node.position.start.offset]) ? concat$10([" ", markAsRoot$1(literalline$3)]) : concat$10(["\\", hardline$9]);
|
|
25775
25869
|
|
|
25776
25870
|
case "liquidNode":
|
|
25777
|
-
return
|
|
25871
|
+
return replaceNewlinesWith(node.value, hardline$9);
|
|
25778
25872
|
|
|
25779
25873
|
case "tableRow": // handled in "table"
|
|
25780
25874
|
|
|
@@ -25818,8 +25912,8 @@ function getNthListSiblingIndex(node, parentNode) {
|
|
|
25818
25912
|
});
|
|
25819
25913
|
}
|
|
25820
25914
|
|
|
25821
|
-
function
|
|
25822
|
-
return join$8(
|
|
25915
|
+
function replaceNewlinesWith(str, doc$$2) {
|
|
25916
|
+
return join$8(doc$$2, str.split("\n"));
|
|
25823
25917
|
}
|
|
25824
25918
|
|
|
25825
25919
|
function getNthSiblingIndex(node, parentNode, condition) {
|
|
@@ -26090,7 +26184,8 @@ function shouldPrePrintDoubleHardline(node, data) {
|
|
|
26090
26184
|
var isInTightListItem = data.parentNode.type === "listItem" && !data.parentNode.loose;
|
|
26091
26185
|
var isPrevNodeLooseListItem = data.prevNode && data.prevNode.type === "listItem" && data.prevNode.loose;
|
|
26092
26186
|
var isPrevNodePrettierIgnore = isPrettierIgnore(data.prevNode) === "next";
|
|
26093
|
-
|
|
26187
|
+
var isBlockHtmlWithoutBlankLineBetweenPrevHtml = node.type === "html" && data.prevNode && data.prevNode.type === "html" && data.prevNode.position.end.line + 1 === node.position.start.line;
|
|
26188
|
+
return isPrevNodeLooseListItem || !(isSiblingNode || isInTightListItem || isPrevNodePrettierIgnore || isBlockHtmlWithoutBlankLineBetweenPrevHtml);
|
|
26094
26189
|
}
|
|
26095
26190
|
|
|
26096
26191
|
function shouldPrePrintTripleHardline(node, data) {
|
|
@@ -26625,6 +26720,11 @@ var languageVue = {
|
|
|
26625
26720
|
printers: printers$6
|
|
26626
26721
|
};
|
|
26627
26722
|
|
|
26723
|
+
// plugin will look for `eval("require")()` and transform to `require()` in the bundle,
|
|
26724
|
+
// and rewrite the paths to require from the top-level.
|
|
26725
|
+
// We need to list the parsers and getters so we can load them only when necessary.
|
|
26726
|
+
|
|
26727
|
+
|
|
26628
26728
|
var internalPlugins = [// JS
|
|
26629
26729
|
languageJs, {
|
|
26630
26730
|
parsers: {
|
|
@@ -26784,7 +26884,7 @@ function loadPlugins(plugins, pluginSearchDirs) {
|
|
|
26784
26884
|
var externalPlugins = lodash_uniqby(externalManualLoadPluginInfos.concat(externalAutoLoadPluginInfos), "requirePath").map(function (externalPluginInfo) {
|
|
26785
26885
|
return Object.assign({
|
|
26786
26886
|
name: externalPluginInfo.name
|
|
26787
|
-
},
|
|
26887
|
+
}, require(externalPluginInfo.requirePath));
|
|
26788
26888
|
});
|
|
26789
26889
|
return internalPlugins.concat(externalPlugins);
|
|
26790
26890
|
}
|
|
@@ -33227,7 +33327,7 @@ function formatStdin(context) {
|
|
|
33227
33327
|
|
|
33228
33328
|
function createIgnorerFromContextOrDie(context) {
|
|
33229
33329
|
try {
|
|
33230
|
-
return createIgnorer_1(context.argv["ignore-path"], context.argv["with-node-modules"]);
|
|
33330
|
+
return createIgnorer_1.sync(context.argv["ignore-path"], context.argv["with-node-modules"]);
|
|
33231
33331
|
} catch (e) {
|
|
33232
33332
|
context.logger.error(e.message);
|
|
33233
33333
|
process.exit(2);
|