prettier 1.16.4 → 1.17.0

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/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.16.4";
17
+ var version$1 = "1.17.0";
18
18
  var description = "Prettier is an opinionated code formatter";
19
19
  var bin = {
20
20
  "prettier": "./bin/prettier.js"
@@ -28,11 +28,12 @@ var engines = {
28
28
  "node": ">=6"
29
29
  };
30
30
  var dependencies = {
31
- "@angular/compiler": "6.1.10",
32
- "@babel/code-frame": "7.0.0-beta.46",
31
+ "@angular/compiler": "7.2.9",
32
+ "@babel/code-frame": "7.0.0",
33
33
  "@babel/parser": "7.2.0",
34
34
  "@glimmer/syntax": "0.30.3",
35
35
  "@iarna/toml": "2.0.0",
36
+ "@typescript-eslint/typescript-estree": "1.6.0",
36
37
  "angular-estree-parser": "1.1.5",
37
38
  "angular-html-parser": "1.2.0",
38
39
  "camelcase": "4.1.0",
@@ -51,11 +52,11 @@ var dependencies = {
51
52
  "flow-parser": "0.84.0",
52
53
  "get-stream": "3.0.0",
53
54
  "globby": "6.1.0",
54
- "graphql": "0.13.2",
55
+ "graphql": "14.2.0",
55
56
  "html-element-attributes": "2.0.0",
56
57
  "html-styles": "1.0.0",
57
58
  "html-tag-names": "1.1.2",
58
- "ignore": "3.3.7",
59
+ "ignore": "4.0.6",
59
60
  "is-ci": "2.0.0",
60
61
  "jest-docblock": "23.2.0",
61
62
  "json-stable-stringify": "1.0.1",
@@ -80,8 +81,7 @@ var dependencies = {
80
81
  "resolve": "1.5.0",
81
82
  "semver": "5.4.1",
82
83
  "string-width": "3.0.0",
83
- "typescript": "3.2.2",
84
- "typescript-estree": "18.0.0",
84
+ "typescript": "3.4.1",
85
85
  "unicode-regex": "2.0.0",
86
86
  "unified": "6.1.6",
87
87
  "vnopts": "1.0.2",
@@ -110,7 +110,7 @@ var devDependencies = {
110
110
  "jest-snapshot-serializer-raw": "1.1.0",
111
111
  "jest-watch-typeahead": "0.1.0",
112
112
  "mkdirp": "0.5.1",
113
- "prettier": "1.16.3",
113
+ "prettier": "1.16.4",
114
114
  "prettylint": "1.0.0",
115
115
  "rimraf": "2.6.2",
116
116
  "rollup": "0.47.6",
@@ -129,9 +129,6 @@ var devDependencies = {
129
129
  "tempy": "0.2.1",
130
130
  "webpack": "3.12.0"
131
131
  };
132
- var resolutions = {
133
- "@babel/code-frame": "7.0.0-beta.46"
134
- };
135
132
  var scripts = {
136
133
  "prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
137
134
  "prepare-release": "yarn && yarn build && yarn test:dist",
@@ -161,7 +158,6 @@ var _package = {
161
158
  engines: engines,
162
159
  dependencies: dependencies,
163
160
  devDependencies: devDependencies,
164
- resolutions: resolutions,
165
161
  scripts: scripts
166
162
  };
167
163
 
@@ -178,7 +174,6 @@ var _package$1 = Object.freeze({
178
174
  engines: engines,
179
175
  dependencies: dependencies,
180
176
  devDependencies: devDependencies,
181
- resolutions: resolutions,
182
177
  scripts: scripts,
183
178
  default: _package
184
179
  });
@@ -3947,6 +3942,10 @@ var options$2 = {
3947
3942
  value: "angular",
3948
3943
  since: "1.15.0",
3949
3944
  description: "Angular"
3945
+ }, {
3946
+ value: "lwc",
3947
+ since: "1.17.0",
3948
+ description: "Lightning Web Components"
3950
3949
  }]
3951
3950
  },
3952
3951
  plugins: {
@@ -8998,19 +8997,20 @@ var loc = {
8998
8997
  };
8999
8998
 
9000
8999
  var jsTokens = createCommonjsModule(function (module, exports) {
9001
- // Copyright 2014, 2015, 2016, 2017 Simon Lydell
9000
+ // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
9002
9001
  // License: MIT. (See LICENSE.)
9003
9002
  Object.defineProperty(exports, "__esModule", {
9004
9003
  value: true
9005
9004
  }); // This regex comes from regex.coffee, and is inserted here by generate-index.js
9006
9005
  // (run `npm run build`).
9007
9006
 
9008
- exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
9007
+ exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
9009
9008
 
9010
9009
  exports.matchToToken = function (match) {
9011
9010
  var token = {
9012
9011
  type: "invalid",
9013
- value: match[0]
9012
+ value: match[0],
9013
+ closed: undefined
9014
9014
  };
9015
9015
  if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
9016
9016
  return token;
@@ -10141,7 +10141,7 @@ var lib$3 = createCommonjsModule(function (module, exports) {
10141
10141
  exports.default = highlight;
10142
10142
 
10143
10143
  function _jsTokens() {
10144
- var data = _interopRequireWildcard(jsTokens);
10144
+ var data = _interopRequireWildcard$$1(jsTokens);
10145
10145
 
10146
10146
  _jsTokens = function _jsTokens() {
10147
10147
  return data;
@@ -10151,7 +10151,7 @@ var lib$3 = createCommonjsModule(function (module, exports) {
10151
10151
  }
10152
10152
 
10153
10153
  function _esutils() {
10154
- var data = _interopRequireDefault(utils$2);
10154
+ var data = _interopRequireDefault$$1(utils$2);
10155
10155
 
10156
10156
  _esutils = function _esutils() {
10157
10157
  return data;
@@ -10161,7 +10161,7 @@ var lib$3 = createCommonjsModule(function (module, exports) {
10161
10161
  }
10162
10162
 
10163
10163
  function _chalk() {
10164
- var data = _interopRequireDefault(chalk$5);
10164
+ var data = _interopRequireDefault$$1(chalk$5);
10165
10165
 
10166
10166
  _chalk = function _chalk() {
10167
10167
  return data;
@@ -10170,13 +10170,13 @@ var lib$3 = createCommonjsModule(function (module, exports) {
10170
10170
  return data;
10171
10171
  }
10172
10172
 
10173
- function _interopRequireDefault(obj) {
10173
+ function _interopRequireDefault$$1(obj) {
10174
10174
  return obj && obj.__esModule ? obj : {
10175
10175
  default: obj
10176
10176
  };
10177
10177
  }
10178
10178
 
10179
- function _interopRequireWildcard(obj) {
10179
+ function _interopRequireWildcard$$1(obj) {
10180
10180
  if (obj && obj.__esModule) {
10181
10181
  return obj;
10182
10182
  } else {
@@ -10221,8 +10221,9 @@ var lib$3 = createCommonjsModule(function (module, exports) {
10221
10221
 
10222
10222
  function getTokenType(match) {
10223
10223
  var _match$slice = match.slice(-2),
10224
- offset = _match$slice[0],
10225
- text = _match$slice[1];
10224
+ _match$slice2 = _slicedToArray(_match$slice, 2),
10225
+ offset = _match$slice2[0],
10226
+ text = _match$slice2[1];
10226
10227
 
10227
10228
  var token = (0, _jsTokens().matchToToken)(match);
10228
10229
 
@@ -10287,10 +10288,8 @@ var lib$3 = createCommonjsModule(function (module, exports) {
10287
10288
  return chalk;
10288
10289
  }
10289
10290
 
10290
- function highlight(code, options) {
10291
- if (options === void 0) {
10292
- options = {};
10293
- }
10291
+ function highlight(code) {
10292
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10294
10293
 
10295
10294
  if (shouldHighlight(options)) {
10296
10295
  var chalk = getChalk(options);
@@ -10360,7 +10359,7 @@ var lib$2 = createCommonjsModule(function (module, exports) {
10360
10359
  var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
10361
10360
 
10362
10361
  function getMarkerLines(loc, source, opts) {
10363
- var startLoc = Object.assign({}, {
10362
+ var startLoc = Object.assign({
10364
10363
  column: 0,
10365
10364
  line: -1
10366
10365
  }, loc.start);
@@ -10419,17 +10418,14 @@ var lib$2 = createCommonjsModule(function (module, exports) {
10419
10418
  }
10420
10419
 
10421
10420
  return {
10422
- start: start,
10423
- end: end,
10424
- markerLines: markerLines
10421
+ start,
10422
+ end,
10423
+ markerLines
10425
10424
  };
10426
10425
  }
10427
10426
 
10428
- function codeFrameColumns(rawLines, loc, opts) {
10429
- if (opts === void 0) {
10430
- opts = {};
10431
- }
10432
-
10427
+ function codeFrameColumns(rawLines, loc) {
10428
+ var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10433
10429
  var highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
10434
10430
  var chalk = (0, _highlight().getChalk)(opts);
10435
10431
  var defs = getDefs(chalk);
@@ -10450,8 +10446,8 @@ var lib$2 = createCommonjsModule(function (module, exports) {
10450
10446
  var numberMaxWidth = String(end).length;
10451
10447
  var frame = lines.slice(start, end).map(function (line, index) {
10452
10448
  var number = start + 1 + index;
10453
- var paddedNumber = (" " + number).slice(-numberMaxWidth);
10454
- var gutter = " " + paddedNumber + " | ";
10449
+ var paddedNumber = ` ${number}`.slice(-numberMaxWidth);
10450
+ var gutter = ` ${paddedNumber} | `;
10455
10451
  var hasMarker = markerLines[number];
10456
10452
  var lastMarkerLine = !markerLines[number + 1];
10457
10453
 
@@ -10470,12 +10466,12 @@ var lib$2 = createCommonjsModule(function (module, exports) {
10470
10466
 
10471
10467
  return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
10472
10468
  } else {
10473
- return " " + maybeHighlight(defs.gutter, gutter) + line;
10469
+ return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
10474
10470
  }
10475
10471
  }).join("\n");
10476
10472
 
10477
10473
  if (opts.message && !hasColumns) {
10478
- frame = "" + " ".repeat(numberMaxWidth + 1) + opts.message + "\n" + frame;
10474
+ frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
10479
10475
  }
10480
10476
 
10481
10477
  if (highlighted) {
@@ -10485,10 +10481,8 @@ var lib$2 = createCommonjsModule(function (module, exports) {
10485
10481
  }
10486
10482
  }
10487
10483
 
10488
- function _default(rawLines, lineNumber, colNumber, opts) {
10489
- if (opts === void 0) {
10490
- opts = {};
10491
- }
10484
+ function _default(rawLines, lineNumber, colNumber) {
10485
+ var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
10492
10486
 
10493
10487
  if (!deprecationWarningShown) {
10494
10488
  deprecationWarningShown = true;
@@ -11160,14 +11154,6 @@ function getPenultimate(arr) {
11160
11154
  return null;
11161
11155
  }
11162
11156
 
11163
- function getLast$3(arr) {
11164
- if (arr.length > 0) {
11165
- return arr[arr.length - 1];
11166
- }
11167
-
11168
- return null;
11169
- }
11170
-
11171
11157
  function skip(chars) {
11172
11158
  return function (text, index, opts) {
11173
11159
  var backwards = opts && opts.backwards; // Allow `skip` functions to be threaded together without having
@@ -11582,7 +11568,7 @@ function printString(raw, options, isDirectiveLiteral) {
11582
11568
  // sure that we consistently output the minimum amount of escaped quotes.
11583
11569
 
11584
11570
 
11585
- return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.parentParser === "html" || options.parentParser === "vue" || options.parentParser === "angular"));
11571
+ return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.parentParser === "html" || options.parentParser === "vue" || options.parentParser === "angular" || options.parentParser === "lwc"));
11586
11572
  }
11587
11573
 
11588
11574
  function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
@@ -11770,7 +11756,7 @@ var util$1 = {
11770
11756
  isExportDeclaration,
11771
11757
  getParentExportDeclaration,
11772
11758
  getPenultimate,
11773
- getLast: getLast$3,
11759
+ getLast,
11774
11760
  getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
11775
11761
  getNextNonSpaceNonCommentCharacterIndex,
11776
11762
  getNextNonSpaceNonCommentCharacter,
@@ -13221,7 +13207,7 @@ function printTrailingComment(commentPath, print, options) {
13221
13207
  return concat([" ", contents]);
13222
13208
  }
13223
13209
 
13224
- return concat([lineSuffix(" " + contents), !isBlock ? breakParent : ""]);
13210
+ return concat([lineSuffix(concat([" ", contents])), !isBlock ? breakParent : ""]);
13225
13211
  }
13226
13212
 
13227
13213
  function printDanglingComments(path$$1, options, sameIndent, filter) {
@@ -14179,367 +14165,384 @@ var core = {
14179
14165
 
14180
14166
  };
14181
14167
 
14182
- var _createClass$1 = function () {
14183
- function defineProperties(target, props) {
14184
- for (var i = 0; i < props.length; i++) {
14185
- var descriptor = props[i];
14186
- descriptor.enumerable = descriptor.enumerable || false;
14187
- descriptor.configurable = true;
14188
- if ("value" in descriptor) descriptor.writable = true;
14189
- Object.defineProperty(target, descriptor.key, descriptor);
14190
- }
14168
+ var ignore = createCommonjsModule(function (module) {
14169
+ // A simple implementation of make-array
14170
+ function make_array(subject) {
14171
+ return Array.isArray(subject) ? subject : [subject];
14191
14172
  }
14192
14173
 
14193
- return function (Constructor, protoProps, staticProps) {
14194
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
14195
- if (staticProps) defineProperties(Constructor, staticProps);
14196
- return Constructor;
14174
+ var REGEX_BLANK_LINE = /^\s+$/;
14175
+ var REGEX_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
14176
+ var REGEX_LEADING_EXCAPED_HASH = /^\\#/;
14177
+ var SLASH = '/';
14178
+ var KEY_IGNORE = typeof Symbol !== 'undefined' ? Symbol.for('node-ignore')
14179
+ /* istanbul ignore next */
14180
+ : 'node-ignore';
14181
+
14182
+ var define = function define(object, key, value) {
14183
+ return Object.defineProperty(object, key, {
14184
+ value
14185
+ });
14197
14186
  };
14198
- }();
14199
14187
 
14200
- function _classCallCheck$1(instance, Constructor) {
14201
- if (!(instance instanceof Constructor)) {
14202
- throw new TypeError("Cannot call a class as a function");
14203
- }
14204
- }
14188
+ var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g; // Sanitize the range of a regular expression
14189
+ // The cases are complicated, see test cases for details
14205
14190
 
14206
- var ignore = function ignore() {
14207
- return new IgnoreBase();
14208
- }; // A simple implementation of make-array
14191
+ var sanitizeRange = function sanitizeRange(range) {
14192
+ return range.replace(REGEX_REGEXP_RANGE, function (match, from, to) {
14193
+ return from.charCodeAt(0) <= to.charCodeAt(0) ? match // Invalid range (out of order) which is ok for gitignore rules but
14194
+ // fatal for JavaScript regular expression, so eliminate it.
14195
+ : '';
14196
+ });
14197
+ }; // > If the pattern ends with a slash,
14198
+ // > it is removed for the purpose of the following description,
14199
+ // > but it would only find a match with a directory.
14200
+ // > In other words, foo/ will match a directory foo and paths underneath it,
14201
+ // > but will not match a regular file or a symbolic link foo
14202
+ // > (this is consistent with the way how pathspec works in general in Git).
14203
+ // '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
14204
+ // -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
14205
+ // you could use option `mark: true` with `glob`
14206
+ // '`foo/`' should not continue with the '`..`'
14207
+
14208
+
14209
+ var DEFAULT_REPLACER_PREFIX = [// > Trailing spaces are ignored unless they are quoted with backslash ("\")
14210
+ [// (a\ ) -> (a )
14211
+ // (a ) -> (a)
14212
+ // (a \ ) -> (a )
14213
+ /\\?\s+$/, function (match) {
14214
+ return match.indexOf('\\') === 0 ? ' ' : '';
14215
+ }], // replace (\ ) with ' '
14216
+ [/\\\s/g, function () {
14217
+ return ' ';
14218
+ }], // Escape metacharacters
14219
+ // which is written down by users but means special for regular expressions.
14220
+ // > There are 12 characters with special meanings:
14221
+ // > - the backslash \,
14222
+ // > - the caret ^,
14223
+ // > - the dollar sign $,
14224
+ // > - the period or dot .,
14225
+ // > - the vertical bar or pipe symbol |,
14226
+ // > - the question mark ?,
14227
+ // > - the asterisk or star *,
14228
+ // > - the plus sign +,
14229
+ // > - the opening parenthesis (,
14230
+ // > - the closing parenthesis ),
14231
+ // > - and the opening square bracket [,
14232
+ // > - the opening curly brace {,
14233
+ // > These special characters are often called "metacharacters".
14234
+ [/[\\^$.|*+(){]/g, function (match) {
14235
+ return `\\${match}`;
14236
+ }], [// > [abc] matches any character inside the brackets
14237
+ // > (in this case a, b, or c);
14238
+ /\[([^\]/]*)($|\])/g, function (match, p1, p2) {
14239
+ return p2 === ']' ? `[${sanitizeRange(p1)}]` : `\\${match}`;
14240
+ }], [// > a question mark (?) matches a single character
14241
+ /(?!\\)\?/g, function () {
14242
+ return '[^/]';
14243
+ }], // leading slash
14244
+ [// > A leading slash matches the beginning of the pathname.
14245
+ // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
14246
+ // A leading slash matches the beginning of the pathname
14247
+ /^\//, function () {
14248
+ return '^';
14249
+ }], // replace special metacharacter slash after the leading slash
14250
+ [/\//g, function () {
14251
+ return '\\/';
14252
+ }], [// > A leading "**" followed by a slash means match in all directories.
14253
+ // > For example, "**/foo" matches file or directory "foo" anywhere,
14254
+ // > the same as pattern "foo".
14255
+ // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
14256
+ // > under directory "foo".
14257
+ // Notice that the '*'s have been replaced as '\\*'
14258
+ /^\^*\\\*\\\*\\\//, // '**/foo' <-> 'foo'
14259
+ function () {
14260
+ return '^(?:.*\\/)?';
14261
+ }]];
14262
+ var DEFAULT_REPLACER_SUFFIX = [// starting
14263
+ [// there will be no leading '/'
14264
+ // (which has been replaced by section "leading slash")
14265
+ // If starts with '**', adding a '^' to the regular expression also works
14266
+ /^(?=[^^])/, function startingReplacer() {
14267
+ return !/\/(?!$)/.test(this) // > If the pattern does not contain a slash /,
14268
+ // > Git treats it as a shell glob pattern
14269
+ // Actually, if there is only a trailing slash,
14270
+ // git also treats it as a shell glob pattern
14271
+ ? '(?:^|\\/)' // > Otherwise, Git treats the pattern as a shell glob suitable for
14272
+ // > consumption by fnmatch(3)
14273
+ : '^';
14274
+ }], // two globstars
14275
+ [// Use lookahead assertions so that we could match more than one `'/**'`
14276
+ /\\\/\\\*\\\*(?=\\\/|$)/g, // Zero, one or several directories
14277
+ // should not use '*', or it will be replaced by the next replacer
14278
+ // Check if it is not the last `'/**'`
14279
+ function (match, index, str) {
14280
+ return index + 6 < str.length // case: /**/
14281
+ // > A slash followed by two consecutive asterisks then a slash matches
14282
+ // > zero or more directories.
14283
+ // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
14284
+ // '/**/'
14285
+ ? '(?:\\/[^\\/]+)*' // case: /**
14286
+ // > A trailing `"/**"` matches everything inside.
14287
+ // #21: everything inside but it should not include the current folder
14288
+ : '\\/.+';
14289
+ }], // intermediate wildcards
14290
+ [// Never replace escaped '*'
14291
+ // ignore rule '\*' will match the path '*'
14292
+ // 'abc.*/' -> go
14293
+ // 'abc.*' -> skip this rule
14294
+ /(^|[^\\]+)\\\*(?=.+)/g, // '*.js' matches '.js'
14295
+ // '*.js' doesn't match 'abc'
14296
+ function (match, p1) {
14297
+ return `${p1}[^\\/]*`;
14298
+ }], // trailing wildcard
14299
+ [/(\^|\\\/)?\\\*$/, function (match, p1) {
14300
+ var prefix = p1 // '\^':
14301
+ // '/*' does not match ''
14302
+ // '/*' does not match everything
14303
+ // '\\\/':
14304
+ // 'abc/*' does not match 'abc/'
14305
+ ? `${p1}[^/]+` // 'a*' matches 'a'
14306
+ // 'a*' matches 'aa'
14307
+ : '[^/]*';
14308
+ return `${prefix}(?=$|\\/$)`;
14309
+ }], [// unescape
14310
+ /\\\\\\/g, function () {
14311
+ return '\\';
14312
+ }]];
14313
+ var POSITIVE_REPLACERS = DEFAULT_REPLACER_PREFIX.concat([// 'f'
14314
+ // matches
14315
+ // - /f(end)
14316
+ // - /f/
14317
+ // - (start)f(end)
14318
+ // - (start)f/
14319
+ // doesn't match
14320
+ // - oof
14321
+ // - foo
14322
+ // pseudo:
14323
+ // -> (^|/)f(/|$)
14324
+ // ending
14325
+ [// 'js' will not match 'js.'
14326
+ // 'ab' will not match 'abc'
14327
+ /(?:[^*/])$/, // 'js*' will not match 'a.js'
14328
+ // 'js/' will not match 'a.js'
14329
+ // 'js' will match 'a.js' and 'a.js/'
14330
+ function (match) {
14331
+ return `${match}(?=$|\\/)`;
14332
+ }]], DEFAULT_REPLACER_SUFFIX);
14333
+ var NEGATIVE_REPLACERS = DEFAULT_REPLACER_PREFIX.concat([// #24, #38
14334
+ // The MISSING rule of [gitignore docs](https://git-scm.com/docs/gitignore)
14335
+ // A negative pattern without a trailing wildcard should not
14336
+ // re-include the things inside that directory.
14337
+ // eg:
14338
+ // ['node_modules/*', '!node_modules']
14339
+ // should ignore `node_modules/a.js`
14340
+ [/(?:[^*])$/, function (match) {
14341
+ return `${match}(?=$|\\/$)`;
14342
+ }]], DEFAULT_REPLACER_SUFFIX); // A simple cache, because an ignore rule only has only one certain meaning
14343
+
14344
+ var cache = Object.create(null); // @param {pattern}
14345
+
14346
+ var make_regex = function make_regex(pattern, negative, ignorecase) {
14347
+ var r = cache[pattern];
14348
+
14349
+ if (r) {
14350
+ return r;
14351
+ }
14352
+
14353
+ var replacers = negative ? NEGATIVE_REPLACERS : POSITIVE_REPLACERS;
14354
+ var source = replacers.reduce(function (prev, current) {
14355
+ return prev.replace(current[0], current[1].bind(pattern));
14356
+ }, pattern);
14357
+ return cache[pattern] = ignorecase ? new RegExp(source, 'i') : new RegExp(source);
14358
+ }; // > A blank line matches no files, so it can serve as a separator for readability.
14359
+
14360
+
14361
+ var checkPattern = function checkPattern(pattern) {
14362
+ return pattern && typeof pattern === 'string' && !REGEX_BLANK_LINE.test(pattern) // > A line starting with # serves as a comment.
14363
+ && pattern.indexOf('#') !== 0;
14364
+ };
14209
14365
 
14366
+ var createRule = function createRule(pattern, ignorecase) {
14367
+ var origin = pattern;
14368
+ var negative = false; // > An optional prefix "!" which negates the pattern;
14210
14369
 
14211
- function make_array(subject) {
14212
- return Array.isArray(subject) ? subject : [subject];
14213
- }
14370
+ if (pattern.indexOf('!') === 0) {
14371
+ negative = true;
14372
+ pattern = pattern.substr(1);
14373
+ }
14214
14374
 
14215
- var REGEX_BLANK_LINE = /^\s+$/;
14216
- var REGEX_LEADING_EXCAPED_EXCLAMATION = /^\\\!/;
14217
- var REGEX_LEADING_EXCAPED_HASH = /^\\#/;
14218
- var SLASH = '/';
14219
- var KEY_IGNORE = typeof Symbol !== 'undefined' ? Symbol.for('node-ignore')
14220
- /* istanbul ignore next */
14221
- : 'node-ignore';
14375
+ pattern = pattern // > Put a backslash ("\") in front of the first "!" for patterns that
14376
+ // > begin with a literal "!", for example, `"\!important!.txt"`.
14377
+ .replace(REGEX_LEADING_EXCAPED_EXCLAMATION, '!') // > Put a backslash ("\") in front of the first hash for patterns that
14378
+ // > begin with a hash.
14379
+ .replace(REGEX_LEADING_EXCAPED_HASH, '#');
14380
+ var regex = make_regex(pattern, negative, ignorecase);
14381
+ return {
14382
+ origin,
14383
+ pattern,
14384
+ negative,
14385
+ regex
14386
+ };
14387
+ };
14222
14388
 
14223
- var IgnoreBase = function () {
14224
- function IgnoreBase() {
14225
- _classCallCheck$1(this, IgnoreBase);
14389
+ var IgnoreBase =
14390
+ /*#__PURE__*/
14391
+ function () {
14392
+ function IgnoreBase() {
14393
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
14394
+ _ref$ignorecase = _ref.ignorecase,
14395
+ ignorecase = _ref$ignorecase === void 0 ? true : _ref$ignorecase;
14226
14396
 
14227
- this._rules = [];
14228
- this[KEY_IGNORE] = true;
14397
+ _classCallCheck(this, IgnoreBase);
14229
14398
 
14230
- this._initCache();
14231
- }
14399
+ this._rules = [];
14400
+ this._ignorecase = ignorecase;
14401
+ define(this, KEY_IGNORE, true);
14232
14402
 
14233
- _createClass$1(IgnoreBase, [{
14234
- key: '_initCache',
14235
- value: function _initCache() {
14236
- this._cache = {};
14237
- } // @param {Array.<string>|string|Ignore} pattern
14403
+ this._initCache();
14404
+ }
14238
14405
 
14239
- }, {
14240
- key: 'add',
14241
- value: function add(pattern) {
14242
- this._added = false;
14406
+ _createClass(IgnoreBase, [{
14407
+ key: "_initCache",
14408
+ value: function _initCache() {
14409
+ this._cache = Object.create(null);
14410
+ } // @param {Array.<string>|string|Ignore} pattern
14243
14411
 
14244
- if (typeof pattern === 'string') {
14245
- pattern = pattern.split(/\r?\n/g);
14246
- }
14412
+ }, {
14413
+ key: "add",
14414
+ value: function add(pattern) {
14415
+ this._added = false;
14247
14416
 
14248
- make_array(pattern).forEach(this._addPattern, this); // Some rules have just added to the ignore,
14249
- // making the behavior changed.
14417
+ if (typeof pattern === 'string') {
14418
+ pattern = pattern.split(/\r?\n/g);
14419
+ }
14250
14420
 
14251
- if (this._added) {
14252
- this._initCache();
14253
- }
14421
+ make_array(pattern).forEach(this._addPattern, this); // Some rules have just added to the ignore,
14422
+ // making the behavior changed.
14254
14423
 
14255
- return this;
14256
- } // legacy
14424
+ if (this._added) {
14425
+ this._initCache();
14426
+ }
14257
14427
 
14258
- }, {
14259
- key: 'addPattern',
14260
- value: function addPattern(pattern) {
14261
- return this.add(pattern);
14262
- }
14263
- }, {
14264
- key: '_addPattern',
14265
- value: function _addPattern(pattern) {
14266
- // #32
14267
- if (pattern && pattern[KEY_IGNORE]) {
14268
- this._rules = this._rules.concat(pattern._rules);
14269
- this._added = true;
14270
- return;
14428
+ return this;
14429
+ } // legacy
14430
+
14431
+ }, {
14432
+ key: "addPattern",
14433
+ value: function addPattern(pattern) {
14434
+ return this.add(pattern);
14271
14435
  }
14436
+ }, {
14437
+ key: "_addPattern",
14438
+ value: function _addPattern(pattern) {
14439
+ // #32
14440
+ if (pattern && pattern[KEY_IGNORE]) {
14441
+ this._rules = this._rules.concat(pattern._rules);
14442
+ this._added = true;
14443
+ return;
14444
+ }
14272
14445
 
14273
- if (this._checkPattern(pattern)) {
14274
- var rule = this._createRule(pattern);
14446
+ if (checkPattern(pattern)) {
14447
+ var rule = createRule(pattern, this._ignorecase);
14448
+ this._added = true;
14275
14449
 
14276
- this._added = true;
14450
+ this._rules.push(rule);
14451
+ }
14452
+ }
14453
+ }, {
14454
+ key: "filter",
14455
+ value: function filter(paths) {
14456
+ var _this = this;
14277
14457
 
14278
- this._rules.push(rule);
14458
+ return make_array(paths).filter(function (path$$1) {
14459
+ return _this._filter(path$$1);
14460
+ });
14279
14461
  }
14280
- }
14281
- }, {
14282
- key: '_checkPattern',
14283
- value: function _checkPattern(pattern) {
14284
- // > A blank line matches no files, so it can serve as a separator for readability.
14285
- return pattern && typeof pattern === 'string' && !REGEX_BLANK_LINE.test(pattern) // > A line starting with # serves as a comment.
14286
- && pattern.indexOf('#') !== 0;
14287
- }
14288
- }, {
14289
- key: 'filter',
14290
- value: function filter(paths) {
14291
- var _this = this;
14462
+ }, {
14463
+ key: "createFilter",
14464
+ value: function createFilter() {
14465
+ var _this2 = this;
14292
14466
 
14293
- return make_array(paths).filter(function (path$$1) {
14294
- return _this._filter(path$$1);
14295
- });
14296
- }
14297
- }, {
14298
- key: 'createFilter',
14299
- value: function createFilter() {
14300
- var _this2 = this;
14467
+ return function (path$$1) {
14468
+ return _this2._filter(path$$1);
14469
+ };
14470
+ }
14471
+ }, {
14472
+ key: "ignores",
14473
+ value: function ignores(path$$1) {
14474
+ return !this._filter(path$$1);
14475
+ } // @returns `Boolean` true if the `path` is NOT ignored
14301
14476
 
14302
- return function (path$$1) {
14303
- return _this2._filter(path$$1);
14304
- };
14305
- }
14306
- }, {
14307
- key: 'ignores',
14308
- value: function ignores(path$$1) {
14309
- return !this._filter(path$$1);
14310
- }
14311
- }, {
14312
- key: '_createRule',
14313
- value: function _createRule(pattern) {
14314
- var origin = pattern;
14315
- var negative = false; // > An optional prefix "!" which negates the pattern;
14477
+ }, {
14478
+ key: "_filter",
14479
+ value: function _filter(path$$1, slices) {
14480
+ if (!path$$1) {
14481
+ return false;
14482
+ }
14316
14483
 
14317
- if (pattern.indexOf('!') === 0) {
14318
- negative = true;
14319
- pattern = pattern.substr(1);
14320
- }
14484
+ if (path$$1 in this._cache) {
14485
+ return this._cache[path$$1];
14486
+ }
14321
14487
 
14322
- pattern = pattern // > Put a backslash ("\") in front of the first "!" for patterns that begin with a literal "!", for example, `"\!important!.txt"`.
14323
- .replace(REGEX_LEADING_EXCAPED_EXCLAMATION, '!') // > Put a backslash ("\") in front of the first hash for patterns that begin with a hash.
14324
- .replace(REGEX_LEADING_EXCAPED_HASH, '#');
14325
- var regex = make_regex(pattern, negative);
14326
- return {
14327
- origin: origin,
14328
- pattern: pattern,
14329
- negative: negative,
14330
- regex: regex
14331
- };
14332
- } // @returns `Boolean` true if the `path` is NOT ignored
14488
+ if (!slices) {
14489
+ // path/to/a.js
14490
+ // ['path', 'to', 'a.js']
14491
+ slices = path$$1.split(SLASH);
14492
+ }
14333
14493
 
14334
- }, {
14335
- key: '_filter',
14336
- value: function _filter(path$$1, slices) {
14337
- if (!path$$1) {
14338
- return false;
14339
- }
14494
+ slices.pop();
14495
+ return this._cache[path$$1] = slices.length // > It is not possible to re-include a file if a parent directory of
14496
+ // > that file is excluded.
14497
+ // If the path contains a parent directory, check the parent first
14498
+ ? this._filter(slices.join(SLASH) + SLASH, slices) && this._test(path$$1) // Or only test the path
14499
+ : this._test(path$$1);
14500
+ } // @returns {Boolean} true if a file is NOT ignored
14340
14501
 
14341
- if (path$$1 in this._cache) {
14342
- return this._cache[path$$1];
14343
- }
14502
+ }, {
14503
+ key: "_test",
14504
+ value: function _test(path$$1) {
14505
+ // Explicitly define variable type by setting matched to `0`
14506
+ var matched = 0;
14507
+
14508
+ this._rules.forEach(function (rule) {
14509
+ // if matched = true, then we only test negative rules
14510
+ // if matched = false, then we test non-negative rules
14511
+ if (!(matched ^ rule.negative)) {
14512
+ matched = rule.negative ^ rule.regex.test(path$$1);
14513
+ }
14514
+ });
14344
14515
 
14345
- if (!slices) {
14346
- // path/to/a.js
14347
- // ['path', 'to', 'a.js']
14348
- slices = path$$1.split(SLASH);
14516
+ return !matched;
14349
14517
  }
14518
+ }]);
14350
14519
 
14351
- slices.pop();
14352
- return this._cache[path$$1] = slices.length // > It is not possible to re-include a file if a parent directory of that file is excluded.
14353
- // If the path contains a parent directory, check the parent first
14354
- ? this._filter(slices.join(SLASH) + SLASH, slices) && this._test(path$$1) // Or only test the path
14355
- : this._test(path$$1);
14356
- } // @returns {Boolean} true if a file is NOT ignored
14520
+ return IgnoreBase;
14521
+ }(); // Windows
14522
+ // --------------------------------------------------------------
14357
14523
 
14358
- }, {
14359
- key: '_test',
14360
- value: function _test(path$$1) {
14361
- // Explicitly define variable type by setting matched to `0`
14362
- var matched = 0;
14524
+ /* istanbul ignore if */
14363
14525
 
14364
- this._rules.forEach(function (rule) {
14365
- // if matched = true, then we only test negative rules
14366
- // if matched = false, then we test non-negative rules
14367
- if (!(matched ^ rule.negative)) {
14368
- matched = rule.negative ^ rule.regex.test(path$$1);
14369
- }
14370
- });
14371
14526
 
14372
- return !matched;
14373
- }
14374
- }]);
14527
+ if ( // Detect `process` so that it can run in browsers.
14528
+ typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) {
14529
+ var filter = IgnoreBase.prototype._filter;
14530
+ /* eslint no-control-regex: "off" */
14375
14531
 
14376
- return IgnoreBase;
14377
- }(); // > If the pattern ends with a slash,
14378
- // > it is removed for the purpose of the following description,
14379
- // > but it would only find a match with a directory.
14380
- // > In other words, foo/ will match a directory foo and paths underneath it,
14381
- // > but will not match a regular file or a symbolic link foo
14382
- // > (this is consistent with the way how pathspec works in general in Git).
14383
- // '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
14384
- // -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
14385
- // you could use option `mark: true` with `glob`
14386
- // '`foo/`' should not continue with the '`..`'
14387
-
14388
-
14389
- var DEFAULT_REPLACER_PREFIX = [// > Trailing spaces are ignored unless they are quoted with backslash ("\")
14390
- [// (a\ ) -> (a )
14391
- // (a ) -> (a)
14392
- // (a \ ) -> (a )
14393
- /\\?\s+$/, function (match) {
14394
- return match.indexOf('\\') === 0 ? ' ' : '';
14395
- }], // replace (\ ) with ' '
14396
- [/\\\s/g, function () {
14397
- return ' ';
14398
- }], // Escape metacharacters
14399
- // which is written down by users but means special for regular expressions.
14400
- // > There are 12 characters with special meanings:
14401
- // > - the backslash \,
14402
- // > - the caret ^,
14403
- // > - the dollar sign $,
14404
- // > - the period or dot .,
14405
- // > - the vertical bar or pipe symbol |,
14406
- // > - the question mark ?,
14407
- // > - the asterisk or star *,
14408
- // > - the plus sign +,
14409
- // > - the opening parenthesis (,
14410
- // > - the closing parenthesis ),
14411
- // > - and the opening square bracket [,
14412
- // > - the opening curly brace {,
14413
- // > These special characters are often called "metacharacters".
14414
- [/[\\\^$.|?*+()\[{]/g, function (match) {
14415
- return '\\' + match;
14416
- }], // leading slash
14417
- [// > A leading slash matches the beginning of the pathname.
14418
- // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
14419
- // A leading slash matches the beginning of the pathname
14420
- /^\//, function () {
14421
- return '^';
14422
- }], // replace special metacharacter slash after the leading slash
14423
- [/\//g, function () {
14424
- return '\\/';
14425
- }], [// > A leading "**" followed by a slash means match in all directories.
14426
- // > For example, "**/foo" matches file or directory "foo" anywhere,
14427
- // > the same as pattern "foo".
14428
- // > "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo".
14429
- // Notice that the '*'s have been replaced as '\\*'
14430
- /^\^*\\\*\\\*\\\//, // '**/foo' <-> 'foo'
14431
- function () {
14432
- return '^(?:.*\\/)?';
14433
- }]];
14434
- var DEFAULT_REPLACER_SUFFIX = [// starting
14435
- [// there will be no leading '/' (which has been replaced by section "leading slash")
14436
- // If starts with '**', adding a '^' to the regular expression also works
14437
- /^(?=[^\^])/, function () {
14438
- return !/\/(?!$)/.test(this) // > If the pattern does not contain a slash /, Git treats it as a shell glob pattern
14439
- // Actually, if there is only a trailing slash, git also treats it as a shell glob pattern
14440
- ? '(?:^|\\/)' // > Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3)
14441
- : '^';
14442
- }], // two globstars
14443
- [// Use lookahead assertions so that we could match more than one `'/**'`
14444
- /\\\/\\\*\\\*(?=\\\/|$)/g, // Zero, one or several directories
14445
- // should not use '*', or it will be replaced by the next replacer
14446
- // Check if it is not the last `'/**'`
14447
- function (match, index, str) {
14448
- return index + 6 < str.length // case: /**/
14449
- // > A slash followed by two consecutive asterisks then a slash matches zero or more directories.
14450
- // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
14451
- // '/**/'
14452
- ? '(?:\\/[^\\/]+)*' // case: /**
14453
- // > A trailing `"/**"` matches everything inside.
14454
- // #21: everything inside but it should not include the current folder
14455
- : '\\/.+';
14456
- }], // intermediate wildcards
14457
- [// Never replace escaped '*'
14458
- // ignore rule '\*' will match the path '*'
14459
- // 'abc.*/' -> go
14460
- // 'abc.*' -> skip this rule
14461
- /(^|[^\\]+)\\\*(?=.+)/g, // '*.js' matches '.js'
14462
- // '*.js' doesn't match 'abc'
14463
- function (match, p1) {
14464
- return p1 + '[^\\/]*';
14465
- }], // trailing wildcard
14466
- [/(\^|\\\/)?\\\*$/, function (match, p1) {
14467
- return (p1 // '\^':
14468
- // '/*' does not match ''
14469
- // '/*' does not match everything
14470
- // '\\\/':
14471
- // 'abc/*' does not match 'abc/'
14472
- ? p1 + '[^/]+' // 'a*' matches 'a'
14473
- // 'a*' matches 'aa'
14474
- : '[^/]*') + '(?=$|\\/$)';
14475
- }], [// unescape
14476
- /\\\\\\/g, function () {
14477
- return '\\';
14478
- }]];
14479
- var POSITIVE_REPLACERS = [].concat(DEFAULT_REPLACER_PREFIX, [// 'f'
14480
- // matches
14481
- // - /f(end)
14482
- // - /f/
14483
- // - (start)f(end)
14484
- // - (start)f/
14485
- // doesn't match
14486
- // - oof
14487
- // - foo
14488
- // pseudo:
14489
- // -> (^|/)f(/|$)
14490
- // ending
14491
- [// 'js' will not match 'js.'
14492
- // 'ab' will not match 'abc'
14493
- /(?:[^*\/])$/, // 'js*' will not match 'a.js'
14494
- // 'js/' will not match 'a.js'
14495
- // 'js' will match 'a.js' and 'a.js/'
14496
- function (match) {
14497
- return match + '(?=$|\\/)';
14498
- }]], DEFAULT_REPLACER_SUFFIX);
14499
- var NEGATIVE_REPLACERS = [].concat(DEFAULT_REPLACER_PREFIX, [// #24
14500
- // The MISSING rule of [gitignore docs](https://git-scm.com/docs/gitignore)
14501
- // A negative pattern without a trailing wildcard should not
14502
- // re-include the things inside that directory.
14503
- // eg:
14504
- // ['node_modules/*', '!node_modules']
14505
- // should ignore `node_modules/a.js`
14506
- [/(?:[^*\/])$/, function (match) {
14507
- return match + '(?=$|\\/$)';
14508
- }]], DEFAULT_REPLACER_SUFFIX); // A simple cache, because an ignore rule only has only one certain meaning
14509
-
14510
- var cache = {}; // @param {pattern}
14511
-
14512
- function make_regex(pattern, negative) {
14513
- var r = cache[pattern];
14514
-
14515
- if (r) {
14516
- return r;
14517
- }
14518
-
14519
- var replacers = negative ? NEGATIVE_REPLACERS : POSITIVE_REPLACERS;
14520
- var source = replacers.reduce(function (prev, current) {
14521
- return prev.replace(current[0], current[1].bind(pattern));
14522
- }, pattern);
14523
- return cache[pattern] = new RegExp(source, 'i');
14524
- } // Windows
14525
- // --------------------------------------------------------------
14526
-
14527
- /* istanbul ignore if */
14528
-
14529
-
14530
- if ( // Detect `process` so that it can run in browsers.
14531
- typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) {
14532
- var filter = IgnoreBase.prototype._filter;
14533
-
14534
- var make_posix = function make_posix(str) {
14535
- return /^\\\\\?\\/.test(str) || /[^\x00-\x80]+/.test(str) ? str : str.replace(/\\/g, '/');
14536
- };
14532
+ var make_posix = function make_posix(str) {
14533
+ return /^\\\\\?\\/.test(str) || /[^\x00-\x80]+/.test(str) ? str : str.replace(/\\/g, '/');
14534
+ };
14537
14535
 
14538
- IgnoreBase.prototype._filter = function (path$$1, slices) {
14539
- path$$1 = make_posix(path$$1);
14540
- return filter.call(this, path$$1, slices);
14536
+ IgnoreBase.prototype._filter = function filterWin32(path$$1, slices) {
14537
+ path$$1 = make_posix(path$$1);
14538
+ return filter.call(this, path$$1, slices);
14539
+ };
14540
+ }
14541
+
14542
+ module.exports = function (options) {
14543
+ return new IgnoreBase(options);
14541
14544
  };
14542
- }
14545
+ });
14543
14546
 
14544
14547
  /**
14545
14548
  * @param {string} filename
@@ -18305,9 +18308,9 @@ function charSet(s) {
18305
18308
 
18306
18309
 
18307
18310
  var slashSplit = /\/+/;
18308
- minimatch.filter = filter$1;
18311
+ minimatch.filter = filter;
18309
18312
 
18310
- function filter$1(pattern, options) {
18313
+ function filter(pattern, options) {
18311
18314
  options = options || {};
18312
18315
  return function (p, i, list) {
18313
18316
  return minimatch(p, pattern, options);
@@ -23099,7 +23102,6 @@ function needsParens(path$$1, options) {
23099
23102
 
23100
23103
  case "ClassExpression":
23101
23104
  case "ClassDeclaration":
23102
- case "TSAbstractClassDeclaration":
23103
23105
  return name === "superClass" && parent.superClass === node;
23104
23106
 
23105
23107
  case "TSTypeAssertion":
@@ -23348,6 +23350,7 @@ function needsParens(path$$1, options) {
23348
23350
 
23349
23351
  case "FunctionExpression":
23350
23352
  switch (parent.type) {
23353
+ case "NewExpression":
23351
23354
  case "CallExpression":
23352
23355
  return name === "callee";
23353
23356
  // Not strictly necessary, but it's clearer to the reader if IIFEs are wrapped in parentheses.
@@ -23392,7 +23395,16 @@ function needsParens(path$$1, options) {
23392
23395
  }
23393
23396
 
23394
23397
  case "ClassExpression":
23395
- return parent.type === "ExportDefaultDeclaration";
23398
+ switch (parent.type) {
23399
+ case "ExportDefaultDeclaration":
23400
+ return true;
23401
+
23402
+ case "NewExpression":
23403
+ return name === "callee" && parent.callee === node;
23404
+
23405
+ default:
23406
+ return false;
23407
+ }
23396
23408
 
23397
23409
  case "OptionalMemberExpression":
23398
23410
  return parent.type === "MemberExpression";
@@ -23424,7 +23436,7 @@ function needsParens(path$$1, options) {
23424
23436
  return false;
23425
23437
 
23426
23438
  case "NGPipeExpression":
23427
- if (parent.type === "NGRoot" || parent.type === "ObjectProperty" || parent.type === "ArrayExpression" || (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.arguments[name] === node || parent.type === "NGPipeExpression" && name === "right" || parent.type === "MemberExpression" && name === "property" || parent.type === "AssignmentExpression") {
23439
+ if (parent.type === "NGRoot" || parent.type === "NGMicrosyntaxExpression" || parent.type === "ObjectProperty" || parent.type === "ArrayExpression" || (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.arguments[name] === node || parent.type === "NGPipeExpression" && name === "right" || parent.type === "MemberExpression" && name === "property" || parent.type === "AssignmentExpression") {
23428
23440
  return false;
23429
23441
  }
23430
23442
 
@@ -23435,7 +23447,7 @@ function needsParens(path$$1, options) {
23435
23447
  }
23436
23448
 
23437
23449
  function isStatement(node) {
23438
- return node.type === "BlockStatement" || node.type === "BreakStatement" || node.type === "ClassBody" || node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "ClassPrivateProperty" || node.type === "ContinueStatement" || node.type === "DebuggerStatement" || node.type === "DeclareClass" || node.type === "DeclareExportAllDeclaration" || node.type === "DeclareExportDeclaration" || node.type === "DeclareFunction" || node.type === "DeclareInterface" || node.type === "DeclareModule" || node.type === "DeclareModuleExports" || node.type === "DeclareVariable" || node.type === "DoWhileStatement" || node.type === "ExportAllDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExpressionStatement" || node.type === "ForAwaitStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "ForStatement" || node.type === "FunctionDeclaration" || node.type === "IfStatement" || node.type === "ImportDeclaration" || node.type === "InterfaceDeclaration" || node.type === "LabeledStatement" || node.type === "MethodDefinition" || node.type === "ReturnStatement" || node.type === "SwitchStatement" || node.type === "ThrowStatement" || node.type === "TryStatement" || node.type === "TSAbstractClassDeclaration" || node.type === "TSDeclareFunction" || node.type === "TSEnumDeclaration" || node.type === "TSImportEqualsDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSModuleDeclaration" || node.type === "TSNamespaceExportDeclaration" || node.type === "TypeAlias" || node.type === "VariableDeclaration" || node.type === "WhileStatement" || node.type === "WithStatement";
23450
+ return node.type === "BlockStatement" || node.type === "BreakStatement" || node.type === "ClassBody" || node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "ClassPrivateProperty" || node.type === "ContinueStatement" || node.type === "DebuggerStatement" || node.type === "DeclareClass" || node.type === "DeclareExportAllDeclaration" || node.type === "DeclareExportDeclaration" || node.type === "DeclareFunction" || node.type === "DeclareInterface" || node.type === "DeclareModule" || node.type === "DeclareModuleExports" || node.type === "DeclareVariable" || node.type === "DoWhileStatement" || node.type === "ExportAllDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExpressionStatement" || node.type === "ForAwaitStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "ForStatement" || node.type === "FunctionDeclaration" || node.type === "IfStatement" || node.type === "ImportDeclaration" || node.type === "InterfaceDeclaration" || node.type === "LabeledStatement" || node.type === "MethodDefinition" || node.type === "ReturnStatement" || node.type === "SwitchStatement" || node.type === "ThrowStatement" || node.type === "TryStatement" || node.type === "TSDeclareFunction" || node.type === "TSEnumDeclaration" || node.type === "TSImportEqualsDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSModuleDeclaration" || node.type === "TSNamespaceExportDeclaration" || node.type === "TypeAlias" || node.type === "VariableDeclaration" || node.type === "WhileStatement" || node.type === "WithStatement";
23439
23451
  }
23440
23452
 
23441
23453
  function getUnparenthesizedNode(node) {
@@ -23585,7 +23597,7 @@ var shouldFlatten$1 = util$1.shouldFlatten;
23585
23597
  var getNextNonSpaceNonCommentCharacter$1 = util$1.getNextNonSpaceNonCommentCharacter;
23586
23598
  var hasNewline$2 = util$1.hasNewline;
23587
23599
  var hasNewlineInRange$1 = util$1.hasNewlineInRange;
23588
- var getLast$4 = util$1.getLast;
23600
+ var getLast$3 = util$1.getLast;
23589
23601
  var getStringWidth$2 = util$1.getStringWidth;
23590
23602
  var printString$1 = util$1.printString;
23591
23603
  var printNumber$1 = util$1.printNumber;
@@ -23607,6 +23619,7 @@ var isVueEventBindingExpression = htmlBinding.isVueEventBindingExpression;
23607
23619
  var hasNode = utils$4.hasNode;
23608
23620
  var hasFlowAnnotationComment = utils$4.hasFlowAnnotationComment;
23609
23621
  var hasFlowShorthandAnnotationComment = utils$4.hasFlowShorthandAnnotationComment;
23622
+ var needsQuoteProps = new WeakMap();
23610
23623
  var _require$$6$builders = doc.builders;
23611
23624
  var concat$4 = _require$$6$builders.concat;
23612
23625
  var join$2 = _require$$6$builders.join;
@@ -23739,7 +23752,7 @@ function genericPrint(path$$1, options, printPath, args) {
23739
23752
  }
23740
23753
 
23741
23754
  function hasNewlineBetweenOrAfterDecorators(node, options) {
23742
- return hasNewlineInRange$1(options.originalText, options.locStart(node.decorators[0]), options.locEnd(getLast$4(node.decorators))) || hasNewline$2(options.originalText, options.locEnd(getLast$4(node.decorators)));
23755
+ return hasNewlineInRange$1(options.originalText, options.locStart(node.decorators[0]), options.locEnd(getLast$3(node.decorators))) || hasNewline$2(options.originalText, options.locEnd(getLast$3(node.decorators)));
23743
23756
  }
23744
23757
 
23745
23758
  function printDecorators(path$$1, options, print) {
@@ -24056,7 +24069,7 @@ function printPathNoParens(path$$1, options, print, args) {
24056
24069
  return chain;
24057
24070
  }
24058
24071
 
24059
- var jsxPart = getLast$4(_parts);
24072
+ var jsxPart = getLast$3(_parts);
24060
24073
  return group$1(concat$4([chain, ifBreak$1(indent$2(jsxPart), jsxPart, {
24061
24074
  groupId
24062
24075
  })]));
@@ -24401,7 +24414,7 @@ function printPathNoParens(path$$1, options, print, args) {
24401
24414
  if ( // We want to keep CommonJS- and AMD-style require calls, and AMD-style
24402
24415
  // define calls, as a unit.
24403
24416
  // e.g. `define(["some/lib", (lib) => {`
24404
- !isNew && n.callee.type === "Identifier" && (n.callee.name === "require" || n.callee.name === "define") || n.callee.type === "Import" || // Template literals as single arguments
24417
+ !isNew && n.callee.type === "Identifier" && (n.callee.name === "require" || n.callee.name === "define") || // Template literals as single arguments
24405
24418
  n.arguments.length === 1 && isTemplateOnItsOwnLine(n.arguments[0], options.originalText, options) || // Keep test declarations on a single line
24406
24419
  // e.g. `it('long name', () => {`
24407
24420
  !isNew && isTestCall(n, path$$1.getParentNode())) {
@@ -24521,7 +24534,7 @@ function printPathNoParens(path$$1, options, print, args) {
24521
24534
  props.push(concat$4(separatorParts.concat(group$1("..."))));
24522
24535
  }
24523
24536
 
24524
- var lastElem = getLast$4(n[propertiesField]);
24537
+ var lastElem = getLast$3(n[propertiesField]);
24525
24538
  var canHaveTrailingSeparator = !(lastElem && (lastElem.type === "RestProperty" || lastElem.type === "RestElement" || hasNodeIgnoreComment$1(lastElem) || n.inexact));
24526
24539
  var content;
24527
24540
 
@@ -24603,7 +24616,7 @@ function printPathNoParens(path$$1, options, print, args) {
24603
24616
  parts.push(group$1(concat$4(["[", comments.printDanglingComments(path$$1, options), softline$1, "]"])));
24604
24617
  }
24605
24618
  } else {
24606
- var _lastElem = getLast$4(n.elements);
24619
+ var _lastElem = getLast$3(n.elements);
24607
24620
 
24608
24621
  var canHaveTrailingComma = !(_lastElem && _lastElem.type === "RestElement"); // JavaScript allows you to have empty elements in an array which
24609
24622
  // changes its length based on the number of commas. The algorithm
@@ -25047,7 +25060,7 @@ function printPathNoParens(path$$1, options, print, args) {
25047
25060
  return group$1(concat$4(["<", path$$1.call(print, "name"), path$$1.call(print, "typeParameters"), " ", concat$4(path$$1.map(print, "attributes")), _n.selfClosing ? " />" : ">"]));
25048
25061
  }
25049
25062
 
25050
- var lastAttrHasTrailingComments = _n.attributes.length && hasTrailingComment(getLast$4(_n.attributes));
25063
+ var lastAttrHasTrailingComments = _n.attributes.length && hasTrailingComment(getLast$3(_n.attributes));
25051
25064
  var bracketSameLine = // Simple tags (no attributes and no comment in tag name) should be
25052
25065
  // kept unbroken regardless of `jsxBracketSameLine`
25053
25066
  !_n.attributes.length && !nameHasComments || options.jsxBracketSameLine && ( // We should print the bracket in a new line for the following cases:
@@ -25153,7 +25166,6 @@ function printPathNoParens(path$$1, options, print, args) {
25153
25166
 
25154
25167
  case "ClassDeclaration":
25155
25168
  case "ClassExpression":
25156
- case "TSAbstractClassDeclaration":
25157
25169
  if (isNodeStartingWithDeclare(n, options)) {
25158
25170
  parts.push("declare ");
25159
25171
  }
@@ -26216,18 +26228,27 @@ function printStatementSequence(path$$1, options, print) {
26216
26228
 
26217
26229
  function printPropertyKey(path$$1, options, print) {
26218
26230
  var node = path$$1.getNode();
26231
+ var parent = path$$1.getParentNode();
26219
26232
  var key = node.key;
26220
26233
 
26221
- if (key.type === "Identifier" && !node.computed && options.parser === "json") {
26234
+ if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
26235
+ var objectHasStringProp = (parent.properties || parent.body || parent.members).some(function (prop) {
26236
+ return prop.key && prop.key.type !== "Identifier" && !isStringPropSafeToCoerceToIdentifier(prop, options);
26237
+ });
26238
+ needsQuoteProps.set(parent, objectHasStringProp);
26239
+ }
26240
+
26241
+ if (key.type === "Identifier" && !node.computed && (options.parser === "json" || options.quoteProps === "consistent" && needsQuoteProps.get(parent))) {
26222
26242
  // a -> "a"
26243
+ var prop = printString$1(JSON.stringify(key.name), options);
26223
26244
  return path$$1.call(function (keyPath) {
26224
26245
  return comments.printComments(keyPath, function () {
26225
- return JSON.stringify(key.name);
26246
+ return prop;
26226
26247
  }, options);
26227
26248
  }, "key");
26228
26249
  }
26229
26250
 
26230
- if (isStringLiteral(key) && isIdentifierName(key.value) && !node.computed && options.parser !== "json" && !(options.parser === "typescript" && node.type === "ClassProperty")) {
26251
+ if (isStringPropSafeToCoerceToIdentifier(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
26231
26252
  // 'a' -> a
26232
26253
  return path$$1.call(function (keyPath) {
26233
26254
  return comments.printComments(keyPath, function () {
@@ -26286,7 +26307,7 @@ function couldGroupArg(arg) {
26286
26307
  }
26287
26308
 
26288
26309
  function shouldGroupLastArg(args) {
26289
- var lastArg = getLast$4(args);
26310
+ var lastArg = getLast$3(args);
26290
26311
  var penultimateArg = getPenultimate$1(args);
26291
26312
  return !hasLeadingComment(lastArg) && !hasTrailingComment(lastArg) && couldGroupArg(lastArg) && ( // If the last two arguments are of the same type,
26292
26313
  // disable last element expansion.
@@ -26382,7 +26403,8 @@ function printArgumentsList(path$$1, options, print) {
26382
26403
 
26383
26404
  return concat$4(parts);
26384
26405
  }, "arguments");
26385
- var maybeTrailingComma = shouldPrintComma(options, "all") ? "," : "";
26406
+ var maybeTrailingComma = // Dynamic imports cannot have trailing commas
26407
+ !(node.callee && node.callee.type === "Import") && shouldPrintComma(options, "all") ? "," : "";
26386
26408
 
26387
26409
  function allArgsBrokenOut() {
26388
26410
  return group$1(concat$4(["(", indent$2(concat$4([line$3, concat$4(printedArguments)])), maybeTrailingComma, line$3, ")"]), {
@@ -26431,14 +26453,14 @@ function printArgumentsList(path$$1, options, print) {
26431
26453
  var somePrintedArgumentsWillBreak = printedArguments.some(willBreak$1);
26432
26454
  return concat$4([somePrintedArgumentsWillBreak ? breakParent$2 : "", conditionalGroup$1([concat$4([ifBreak$1(indent$2(concat$4(["(", softline$1, concat$4(printedExpanded)])), concat$4(["(", concat$4(printedExpanded)])), somePrintedArgumentsWillBreak ? concat$4([ifBreak$1(maybeTrailingComma), softline$1]) : "", ")"]), shouldGroupFirst ? concat$4(["(", group$1(printedExpanded[0], {
26433
26455
  shouldBreak: true
26434
- }), concat$4(printedExpanded.slice(1)), ")"]) : concat$4(["(", concat$4(printedArguments.slice(0, -1)), group$1(getLast$4(printedExpanded), {
26456
+ }), concat$4(printedExpanded.slice(1)), ")"]) : concat$4(["(", concat$4(printedArguments.slice(0, -1)), group$1(getLast$3(printedExpanded), {
26435
26457
  shouldBreak: true
26436
26458
  }), ")"]), allArgsBrokenOut()], {
26437
26459
  shouldBreak
26438
26460
  })]);
26439
26461
  }
26440
26462
 
26441
- return group$1(concat$4(["(", indent$2(concat$4([softline$1, concat$4(printedArguments)])), ifBreak$1(shouldPrintComma(options, "all") ? "," : ""), softline$1, ")"]), {
26463
+ return group$1(concat$4(["(", indent$2(concat$4([softline$1, concat$4(printedArguments)])), ifBreak$1(maybeTrailingComma), softline$1, ")"]), {
26442
26464
  shouldBreak: printedArguments.some(willBreak$1) || anyArgEmptyLine
26443
26465
  });
26444
26466
  }
@@ -26477,12 +26499,37 @@ function printFunctionTypeParameters(path$$1, options, print) {
26477
26499
 
26478
26500
  function printFunctionParams(path$$1, print, options, expandArg, printTypeParams) {
26479
26501
  var fun = path$$1.getValue();
26502
+ var parent = path$$1.getParentNode();
26480
26503
  var paramsField = fun.parameters ? "parameters" : "params";
26504
+ var isParametersInTestCall = isTestCall(parent);
26505
+ var shouldHugParameters = shouldHugArguments(fun);
26506
+ var shouldExpandParameters = expandArg && !(fun[paramsField] && fun[paramsField].some(function (n) {
26507
+ return n.comments;
26508
+ }));
26481
26509
  var typeParams = printTypeParams ? printFunctionTypeParameters(path$$1, options, print) : "";
26482
26510
  var printed = [];
26483
26511
 
26484
26512
  if (fun[paramsField]) {
26485
- printed = path$$1.map(print, paramsField);
26513
+ var lastArgIndex = fun[paramsField].length - 1;
26514
+ printed = path$$1.map(function (childPath, index) {
26515
+ var parts = [];
26516
+ var param = childPath.getValue();
26517
+ parts.push(print(childPath));
26518
+
26519
+ if (index === lastArgIndex) {
26520
+ if (fun.rest) {
26521
+ parts.push(",", line$3);
26522
+ }
26523
+ } else if (isParametersInTestCall || shouldHugParameters || shouldExpandParameters) {
26524
+ parts.push(", ");
26525
+ } else if (isNextLineEmpty$2(options.originalText, param, options)) {
26526
+ parts.push(",", hardline$3, hardline$3);
26527
+ } else {
26528
+ parts.push(",", line$3);
26529
+ }
26530
+
26531
+ return concat$4(parts);
26532
+ }, paramsField);
26486
26533
  }
26487
26534
 
26488
26535
  if (fun.rest) {
@@ -26497,7 +26544,7 @@ function printFunctionParams(path$$1, print, options, expandArg, printTypeParams
26497
26544
  }), ")"]);
26498
26545
  }
26499
26546
 
26500
- var lastParam = getLast$4(fun[paramsField]); // If the parent is a call with the first/last argument expansion and this is the
26547
+ var lastParam = getLast$3(fun[paramsField]); // If the parent is a call with the first/last argument expansion and this is the
26501
26548
  // params of the first/last argument, we dont want the arguments to break and instead
26502
26549
  // want the whole expression to be on a new line.
26503
26550
  //
@@ -26508,10 +26555,8 @@ function printFunctionParams(path$$1, print, options, expandArg, printTypeParams
26508
26555
  // }) ) => {
26509
26556
  // })
26510
26557
 
26511
- if (expandArg && !(fun[paramsField] && fun[paramsField].some(function (n) {
26512
- return n.comments;
26513
- }))) {
26514
- return group$1(concat$4([removeLines$1(typeParams), "(", join$2(", ", printed.map(removeLines$1)), ")"]));
26558
+ if (shouldExpandParameters) {
26559
+ return group$1(concat$4([removeLines$1(typeParams), "(", concat$4(printed.map(removeLines$1)), ")"]));
26515
26560
  } // Single object destructuring should hug
26516
26561
  //
26517
26562
  // function({
@@ -26521,14 +26566,13 @@ function printFunctionParams(path$$1, print, options, expandArg, printTypeParams
26521
26566
  // }) {}
26522
26567
 
26523
26568
 
26524
- if (shouldHugArguments(fun)) {
26525
- return concat$4([typeParams, "(", join$2(", ", printed), ")"]);
26526
- }
26569
+ if (shouldHugParameters) {
26570
+ return concat$4([typeParams, "(", concat$4(printed), ")"]);
26571
+ } // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})`
26527
26572
 
26528
- var parent = path$$1.getParentNode(); // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})`
26529
26573
 
26530
- if (isTestCall(parent)) {
26531
- return concat$4([typeParams, "(", join$2(", ", printed), ")"]);
26574
+ if (isParametersInTestCall) {
26575
+ return concat$4([typeParams, "(", concat$4(printed), ")"]);
26532
26576
  }
26533
26577
 
26534
26578
  var isFlowShorthandWithOneArg = (isObjectTypePropertyAFunction(parent, options) || isTypeAnnotationAFunction(parent, options) || parent.type === "TypeAlias" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || parent.type === "IntersectionTypeAnnotation" || parent.type === "FunctionTypeAnnotation" && parent.returnType === fun) && fun[paramsField].length === 1 && fun[paramsField][0].name === null && fun[paramsField][0].typeAnnotation && fun.typeParameters === null && isSimpleFlowType(fun[paramsField][0].typeAnnotation) && !fun.rest;
@@ -26542,7 +26586,7 @@ function printFunctionParams(path$$1, print, options, expandArg, printTypeParams
26542
26586
  }
26543
26587
 
26544
26588
  var canHaveTrailingComma = !(lastParam && lastParam.type === "RestElement") && !fun.rest;
26545
- return concat$4([typeParams, "(", indent$2(concat$4([softline$1, join$2(concat$4([",", line$3]), printed)])), ifBreak$1(canHaveTrailingComma && shouldPrintComma(options, "all") ? "," : ""), softline$1, ")"]);
26589
+ return concat$4([typeParams, "(", indent$2(concat$4([softline$1, concat$4(printed)])), ifBreak$1(canHaveTrailingComma && shouldPrintComma(options, "all") ? "," : ""), softline$1, ")"]);
26546
26590
  }
26547
26591
 
26548
26592
  function shouldPrintParamsWithoutParens(path$$1, options) {
@@ -26657,7 +26701,7 @@ function printExportDeclaration(path$$1, options, print) {
26657
26701
  if (decl.declaration) {
26658
26702
  parts.push(path$$1.call(print, "declaration"));
26659
26703
 
26660
- if (isDefault && decl.declaration.type !== "ClassDeclaration" && decl.declaration.type !== "FunctionDeclaration" && decl.declaration.type !== "TSAbstractClassDeclaration" && decl.declaration.type !== "TSInterfaceDeclaration" && decl.declaration.type !== "DeclareClass" && decl.declaration.type !== "DeclareFunction" && decl.declaration.type !== "TSDeclareFunction") {
26704
+ if (isDefault && decl.declaration.type !== "ClassDeclaration" && decl.declaration.type !== "FunctionDeclaration" && decl.declaration.type !== "TSInterfaceDeclaration" && decl.declaration.type !== "DeclareClass" && decl.declaration.type !== "DeclareFunction" && decl.declaration.type !== "TSDeclareFunction") {
26661
26705
  parts.push(semi);
26662
26706
  }
26663
26707
  } else {
@@ -26768,7 +26812,7 @@ function printClass(path$$1, options, print) {
26768
26812
  var n = path$$1.getValue();
26769
26813
  var parts = [];
26770
26814
 
26771
- if (n.type === "TSAbstractClassDeclaration") {
26815
+ if (n.abstract) {
26772
26816
  parts.push("abstract ");
26773
26817
  }
26774
26818
 
@@ -27069,27 +27113,23 @@ function printMemberChain(path$$1, options, print) {
27069
27113
  return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpression && isShort(firstNode.name) || hasComputed);
27070
27114
  }
27071
27115
 
27072
- var lastNode = getLast$4(groups[0]).node;
27116
+ var lastNode = getLast$3(groups[0]).node;
27073
27117
  return (lastNode.type === "MemberExpression" || lastNode.type === "OptionalMemberExpression") && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed);
27074
27118
  }
27075
27119
 
27076
27120
  var shouldMerge = groups.length >= 2 && !groups[1][0].node.comments && shouldNotWrap(groups);
27077
27121
 
27078
27122
  function printGroup(printedGroup) {
27079
- var result = [];
27123
+ var printed = printedGroup.map(function (tuple) {
27124
+ return tuple.printed;
27125
+ }); // Checks if the last node (i.e. the parent node) needs parens and print
27126
+ // accordingly
27080
27127
 
27081
- for (var _i3 = 0; _i3 < printedGroup.length; _i3++) {
27082
- // Checks if the next node (i.e. the parent node) needs parens
27083
- // and print accordingly
27084
- if (printedGroup[_i3 + 1] && printedGroup[_i3 + 1].needsParens) {
27085
- result.push("(", printedGroup[_i3].printed, printedGroup[_i3 + 1].printed, ")");
27086
- _i3++;
27087
- } else {
27088
- result.push(printedGroup[_i3].printed);
27089
- }
27128
+ if (printedGroup.length > 0 && printedGroup[printedGroup.length - 1].needsParens) {
27129
+ return concat$4(["("].concat(_toConsumableArray(printed), [")"]));
27090
27130
  }
27091
27131
 
27092
- return concat$4(result);
27132
+ return concat$4(printed);
27093
27133
  }
27094
27134
 
27095
27135
  function printIndentedGroup(groups) {
@@ -27119,7 +27159,7 @@ function printMemberChain(path$$1, options, print) {
27119
27159
  // empty line after
27120
27160
 
27121
27161
 
27122
- var lastNodeBeforeIndent = getLast$4(shouldMerge ? groups.slice(1, 2)[0] : groups[0]).node;
27162
+ var lastNodeBeforeIndent = getLast$3(shouldMerge ? groups.slice(1, 2)[0] : groups[0]).node;
27123
27163
  var shouldHaveEmptyLineBeforeIndent = lastNodeBeforeIndent.type !== "CallExpression" && lastNodeBeforeIndent.type !== "OptionalCallExpression" && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
27124
27164
  var expanded = concat$4([printGroup(groups[0]), shouldMerge ? concat$4(groups.slice(1, 2).map(printGroup)) : "", shouldHaveEmptyLineBeforeIndent ? hardline$3 : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))]);
27125
27165
  var callExpressions = printedNodes.map(function (_ref) {
@@ -27139,7 +27179,7 @@ function printMemberChain(path$$1, options, print) {
27139
27179
  */
27140
27180
  function (lastGroupDoc, lastGroupNode) {
27141
27181
  return isCallOrOptionalCallExpression(lastGroupNode) && willBreak$1(lastGroupDoc);
27142
- }(getLast$4(printedGroups), getLast$4(getLast$4(groups)).node) && callExpressions.slice(0, -1).some(function (n) {
27182
+ }(getLast$3(printedGroups), getLast$3(getLast$3(groups)).node) && callExpressions.slice(0, -1).some(function (n) {
27143
27183
  return n.arguments.some(isFunctionOrArrowExpression);
27144
27184
  })) {
27145
27185
  return group$1(expanded);
@@ -27350,7 +27390,7 @@ function printJSXChildren(path$$1, options, print, jsxWhitespace, isFacebookTran
27350
27390
 
27351
27391
  var endWhitespace; // Ends with whitespace
27352
27392
 
27353
- if (getLast$4(words) === "") {
27393
+ if (getLast$3(words) === "") {
27354
27394
  words.pop();
27355
27395
  endWhitespace = words.pop();
27356
27396
  } // This was whitespace only without a new line.
@@ -27371,13 +27411,13 @@ function printJSXChildren(path$$1, options, print, jsxWhitespace, isFacebookTran
27371
27411
  if (endWhitespace !== undefined) {
27372
27412
  if (/\n/.test(endWhitespace)) {
27373
27413
  var _next = n.children[i + 1];
27374
- children.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$4(children), child, _next));
27414
+ children.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$3(children), child, _next));
27375
27415
  } else {
27376
27416
  children.push(jsxWhitespace);
27377
27417
  }
27378
27418
  } else {
27379
27419
  var _next2 = n.children[i + 1];
27380
- children.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$4(children), child, _next2));
27420
+ children.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$3(children), child, _next2));
27381
27421
  }
27382
27422
  } else if (/\n/.test(text)) {
27383
27423
  // Keep (up to one) blank line between tags/expressions/text.
@@ -27486,7 +27526,7 @@ function printJSXElement(path$$1, options, print) {
27486
27526
  } // Trim trailing lines (or empty strings)
27487
27527
 
27488
27528
 
27489
- while (children.length && (isLineNext$1(getLast$4(children)) || isEmpty$1(getLast$4(children)))) {
27529
+ while (children.length && (isLineNext$1(getLast$3(children)) || isEmpty$1(getLast$3(children)))) {
27490
27530
  children.pop();
27491
27531
  } // Trim leading lines (or empty strings)
27492
27532
 
@@ -28033,7 +28073,7 @@ function needsHardlineAfterDanglingComment(node) {
28033
28073
  return false;
28034
28074
  }
28035
28075
 
28036
- var lastDanglingComment = getLast$4(node.comments.filter(function (comment) {
28076
+ var lastDanglingComment = getLast$3(node.comments.filter(function (comment) {
28037
28077
  return !comment.leading && !comment.trailing;
28038
28078
  }));
28039
28079
  return lastDanglingComment && !comments$3.isBlockComment(lastDanglingComment);
@@ -28043,6 +28083,10 @@ function isLiteral(node) {
28043
28083
  return node.type === "BooleanLiteral" || node.type === "DirectiveLiteral" || node.type === "Literal" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "RegExpLiteral" || node.type === "StringLiteral" || node.type === "TemplateLiteral" || node.type === "TSTypeLiteral" || node.type === "JSXText";
28044
28084
  }
28045
28085
 
28086
+ function isStringPropSafeToCoerceToIdentifier(node, options) {
28087
+ return isStringLiteral(node.key) && isIdentifierName(node.key.value) && !node.computed && options.parser !== "json" && !(options.parser === "typescript" && node.type === "ClassProperty");
28088
+ }
28089
+
28046
28090
  function isNumericLiteral(node) {
28047
28091
  return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number";
28048
28092
  }
@@ -28133,7 +28177,7 @@ function willPrintOwnComments(path$$1) {
28133
28177
  }
28134
28178
 
28135
28179
  function canAttachComment(node) {
28136
- return node.type && node.type !== "CommentBlock" && node.type !== "CommentLine" && node.type !== "Line" && node.type !== "Block" && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import" && !(node.callee && node.callee.type === "Import");
28180
+ return node.type && node.type !== "CommentBlock" && node.type !== "CommentLine" && node.type !== "Line" && node.type !== "Block" && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import";
28137
28181
  }
28138
28182
 
28139
28183
  function printComment$1(commentPath, options) {
@@ -28385,6 +28429,23 @@ var options$3 = {
28385
28429
  default: false,
28386
28430
  description: "Use single quotes in JSX."
28387
28431
  },
28432
+ quoteProps: {
28433
+ since: "1.17.0",
28434
+ category: CATEGORY_JAVASCRIPT,
28435
+ type: "choice",
28436
+ default: "as-needed",
28437
+ description: "Change when properties in objects are quoted.",
28438
+ choices: [{
28439
+ value: "as-needed",
28440
+ description: "Only add quotes around object properties where required."
28441
+ }, {
28442
+ value: "consistent",
28443
+ description: "If at least one property in an object requires quotes, quote all properties."
28444
+ }, {
28445
+ value: "preserve",
28446
+ description: "Respect the input use of quotes in object properties."
28447
+ }]
28448
+ },
28388
28449
  trailingComma: {
28389
28450
  since: "0.0.0",
28390
28451
  category: CATEGORY_JAVASCRIPT,
@@ -30538,7 +30599,7 @@ function genericPrint$3(path$$1, options, print) {
30538
30599
 
30539
30600
  case "FragmentDefinition":
30540
30601
  {
30541
- return concat$11(["fragment ", path$$1.call(print, "name"), " on ", path$$1.call(print, "typeCondition"), printDirectives(path$$1, print, n), " ", path$$1.call(print, "selectionSet")]);
30602
+ return concat$11(["fragment ", path$$1.call(print, "name"), n.variableDefinitions && n.variableDefinitions.length ? group$12(concat$11(["(", indent$7(concat$11([softline$5, join$8(concat$11([ifBreak$4("", ", "), softline$5]), path$$1.map(print, "variableDefinitions"))])), softline$5, ")"])) : "", " on ", path$$1.call(print, "typeCondition"), printDirectives(path$$1, print, n), " ", path$$1.call(print, "selectionSet")]);
30542
30603
  }
30543
30604
 
30544
30605
  case "SelectionSet":
@@ -30621,7 +30682,7 @@ function genericPrint$3(path$$1, options, print) {
30621
30682
 
30622
30683
  case "VariableDefinition":
30623
30684
  {
30624
- return concat$11([path$$1.call(print, "variable"), ": ", path$$1.call(print, "type"), n.defaultValue ? concat$11([" = ", path$$1.call(print, "defaultValue")]) : ""]);
30685
+ return concat$11([path$$1.call(print, "variable"), ": ", path$$1.call(print, "type"), n.defaultValue ? concat$11([" = ", path$$1.call(print, "defaultValue")]) : "", printDirectives(path$$1, print, n)]);
30625
30686
  }
30626
30687
 
30627
30688
  case "TypeExtensionDefinition":
@@ -30854,7 +30915,7 @@ var json$6 = {"cjkPattern":"[\\u02ea-\\u02eb\\u1100-\\u11ff\\u2e80-\\u2e99\\u2e9
30854
30915
  var cjkPattern = json$6.cjkPattern;
30855
30916
  var kPattern = json$6.kPattern;
30856
30917
  var punctuationPattern$1 = json$6.punctuationPattern;
30857
- var getLast$5 = util$1.getLast;
30918
+ var getLast$4 = util$1.getLast;
30858
30919
  var INLINE_NODE_TYPES$1 = ["liquidNode", "inlineCode", "emphasis", "strong", "delete", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"];
30859
30920
  var INLINE_NODE_WRAPPER_TYPES$1 = INLINE_NODE_TYPES$1.concat(["tableCell", "paragraph", "heading"]);
30860
30921
  var kRegex = new RegExp(kPattern);
@@ -30899,7 +30960,7 @@ function splitText$1(text, options) {
30899
30960
  value: innerToken,
30900
30961
  kind: KIND_NON_CJK,
30901
30962
  hasLeadingPunctuation: punctuationRegex.test(innerToken[0]),
30902
- hasTrailingPunctuation: punctuationRegex.test(getLast$5(innerToken))
30963
+ hasTrailingPunctuation: punctuationRegex.test(getLast$4(innerToken))
30903
30964
  });
30904
30965
  }
30905
30966
 
@@ -30925,7 +30986,7 @@ function splitText$1(text, options) {
30925
30986
  return nodes;
30926
30987
 
30927
30988
  function appendNode(node) {
30928
- var lastNode = getLast$5(nodes);
30989
+ var lastNode = getLast$4(nodes);
30929
30990
 
30930
30991
  if (lastNode && lastNode.type === "word") {
30931
30992
  if (lastNode.kind === KIND_NON_CJK && node.kind === KIND_CJ_LETTER && !lastNode.hasTrailingPunctuation || lastNode.kind === KIND_CJ_LETTER && node.kind === KIND_NON_CJK && !node.hasLeadingPunctuation) {
@@ -31387,6 +31448,7 @@ function markAlignedList(ast, options) {
31387
31448
  var preprocess_1$2 = preprocess$2;
31388
31449
 
31389
31450
  var _require$$0$builders$6 = doc.builders;
31451
+ var breakParent$3 = _require$$0$builders$6.breakParent;
31390
31452
  var concat$12 = _require$$0$builders$6.concat;
31391
31453
  var join$9 = _require$$0$builders$6.join;
31392
31454
  var line$8 = _require$$0$builders$6.line;
@@ -31394,6 +31456,7 @@ var literalline$4 = _require$$0$builders$6.literalline;
31394
31456
  var markAsRoot$2 = _require$$0$builders$6.markAsRoot;
31395
31457
  var hardline$10 = _require$$0$builders$6.hardline;
31396
31458
  var softline$6 = _require$$0$builders$6.softline;
31459
+ var ifBreak$5 = _require$$0$builders$6.ifBreak;
31397
31460
  var fill$4 = _require$$0$builders$6.fill;
31398
31461
  var align$2 = _require$$0$builders$6.align;
31399
31462
  var indent$8 = _require$$0$builders$6.indent;
@@ -31746,6 +31809,7 @@ function printLine(path$$1, value, options) {
31746
31809
  }
31747
31810
 
31748
31811
  function printTable(path$$1, options, print) {
31812
+ var hardlineWithoutBreakParent = hardline$10.parts[0];
31749
31813
  var node = path$$1.getValue();
31750
31814
  var contents = []; // { [rowIndex: number]: { [columnIndex: number]: string } }
31751
31815
 
@@ -31755,7 +31819,8 @@ function printTable(path$$1, options, print) {
31755
31819
  rowContents.push(printDocToString$3(cellPath.call(print), options).formatted);
31756
31820
  }, "children");
31757
31821
  contents.push(rowContents);
31758
- }, "children");
31822
+ }, "children"); // Get the width of each column
31823
+
31759
31824
  var columnMaxWidths = contents.reduce(function (currentWidths, rowContents) {
31760
31825
  return currentWidths.map(function (width, columnIndex) {
31761
31826
  return Math.max(width, util$1.getStringWidth(rowContents[columnIndex]));
@@ -31764,28 +31829,48 @@ function printTable(path$$1, options, print) {
31764
31829
  return 3;
31765
31830
  }) // minimum width = 3 (---, :--, :-:, --:)
31766
31831
  );
31767
- return join$9(hardline$10, [printRow(contents[0]), printSeparator(), join$9(hardline$10, contents.slice(1).map(printRow))]);
31768
-
31769
- function printSeparator() {
31832
+ var alignedTable = join$9(hardlineWithoutBreakParent, [printRow(contents[0]), printSeparator(), join$9(hardlineWithoutBreakParent, contents.slice(1).map(function (rowContents) {
31833
+ return printRow(rowContents);
31834
+ }))]);
31835
+
31836
+ if (options.proseWrap !== "never") {
31837
+ return concat$12([breakParent$3, alignedTable]);
31838
+ } // Only if the --prose-wrap never is set and it exceeds the print width.
31839
+
31840
+
31841
+ var compactTable = join$9(hardlineWithoutBreakParent, [printRow(contents[0],
31842
+ /* isCompact */
31843
+ true), printSeparator(
31844
+ /* isCompact */
31845
+ true), join$9(hardlineWithoutBreakParent, contents.slice(1).map(function (rowContents) {
31846
+ return printRow(rowContents,
31847
+ /* isCompact */
31848
+ true);
31849
+ }))]);
31850
+ return concat$12([breakParent$3, group$13(ifBreak$5(compactTable, alignedTable))]);
31851
+
31852
+ function printSeparator(isCompact) {
31770
31853
  return concat$12(["| ", join$9(" | ", columnMaxWidths.map(function (width, index) {
31854
+ var spaces = isCompact ? 3 : width;
31855
+
31771
31856
  switch (node.align[index]) {
31772
31857
  case "left":
31773
- return ":" + "-".repeat(width - 1);
31858
+ return ":" + "-".repeat(spaces - 1);
31774
31859
 
31775
31860
  case "right":
31776
- return "-".repeat(width - 1) + ":";
31861
+ return "-".repeat(spaces - 1) + ":";
31777
31862
 
31778
31863
  case "center":
31779
- return ":" + "-".repeat(width - 2) + ":";
31864
+ return ":" + "-".repeat(spaces - 2) + ":";
31780
31865
 
31781
31866
  default:
31782
- return "-".repeat(width);
31867
+ return "-".repeat(spaces);
31783
31868
  }
31784
31869
  })), " |"]);
31785
31870
  }
31786
31871
 
31787
- function printRow(rowContents) {
31788
- return concat$12(["| ", join$9(" | ", rowContents.map(function (rowContent, columnIndex) {
31872
+ function printRow(rowContents, isCompact) {
31873
+ return concat$12(["| ", join$9(" | ", isCompact ? rowContents : rowContents.map(function (rowContent, columnIndex) {
31789
31874
  switch (node.align[columnIndex]) {
31790
31875
  case "right":
31791
31876
  return alignRight(rowContent, columnMaxWidths[columnIndex]);
@@ -31800,11 +31885,13 @@ function printTable(path$$1, options, print) {
31800
31885
  }
31801
31886
 
31802
31887
  function alignLeft(text, width) {
31803
- return concat$12([text, " ".repeat(width - util$1.getStringWidth(text))]);
31888
+ var spaces = width - util$1.getStringWidth(text);
31889
+ return concat$12([text, " ".repeat(spaces)]);
31804
31890
  }
31805
31891
 
31806
31892
  function alignRight(text, width) {
31807
- return concat$12([" ".repeat(width - util$1.getStringWidth(text)), text]);
31893
+ var spaces = width - util$1.getStringWidth(text);
31894
+ return concat$12([" ".repeat(spaces), text]);
31808
31895
  }
31809
31896
 
31810
31897
  function alignCenter(text, width) {
@@ -33829,7 +33916,7 @@ var parseSrcset = createCommonjsModule(function (module) {
33829
33916
 
33830
33917
  var _require$$0$builders$9 = doc.builders;
33831
33918
  var concat$16 = _require$$0$builders$9.concat;
33832
- var ifBreak$6 = _require$$0$builders$9.ifBreak;
33919
+ var ifBreak$7 = _require$$0$builders$9.ifBreak;
33833
33920
  var join$11 = _require$$0$builders$9.join;
33834
33921
  var line$10 = _require$$0$builders$9.line;
33835
33922
 
@@ -33887,7 +33974,7 @@ function printImgSrcset$1(value) {
33887
33974
  var urlPadding = maxUrlLength - url.length + 1;
33888
33975
  var descriptorPadding = maxDescriptorLeftLength - descriptorLeftLengths[index];
33889
33976
  var alignment = " ".repeat(urlPadding + descriptorPadding);
33890
- parts.push(ifBreak$6(alignment, " "), descriptor + unit);
33977
+ parts.push(ifBreak$7(alignment, " "), descriptor + unit);
33891
33978
  }
33892
33979
 
33893
33980
  return concat$16(parts);
@@ -33902,12 +33989,12 @@ var builders = doc.builders;
33902
33989
  var _require$$0$utils = doc.utils;
33903
33990
  var stripTrailingHardline$2 = _require$$0$utils.stripTrailingHardline;
33904
33991
  var mapDoc$7 = _require$$0$utils.mapDoc;
33905
- var breakParent$3 = builders.breakParent;
33992
+ var breakParent$4 = builders.breakParent;
33906
33993
  var dedentToRoot$2 = builders.dedentToRoot;
33907
33994
  var fill$5 = builders.fill;
33908
33995
  var group$14 = builders.group;
33909
33996
  var hardline$12 = builders.hardline;
33910
- var ifBreak$5 = builders.ifBreak;
33997
+ var ifBreak$6 = builders.ifBreak;
33911
33998
  var indent$9 = builders.indent;
33912
33999
  var join$10 = builders.join;
33913
34000
  var line$9 = builders.line;
@@ -33954,7 +34041,7 @@ function embed$6(path$$1, print, textToDoc, options) {
33954
34041
 
33955
34042
  if (parser) {
33956
34043
  var value = parser === "markdown" ? dedentString(node.value.replace(/^[^\S\n]*?\n/, "")) : node.value;
33957
- return builders.concat([concat$14([breakParent$3, printOpeningTagPrefix(node, options), stripTrailingHardline$2(textToDoc(value, {
34044
+ return builders.concat([concat$14([breakParent$4, printOpeningTagPrefix(node, options), stripTrailingHardline$2(textToDoc(value, {
33958
34045
  parser
33959
34046
  })), printClosingTagSuffix(node, options)])]);
33960
34047
  }
@@ -33984,6 +34071,15 @@ function embed$6(path$$1, print, textToDoc, options) {
33984
34071
 
33985
34072
  if (/^PRETTIER_HTML_PLACEHOLDER_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
33986
34073
  return concat$14([node.rawName, "=", node.value]);
34074
+ } // lwc: html`<my-element data-for={value}></my-elememt>`
34075
+
34076
+
34077
+ if (options.parser === "lwc") {
34078
+ var interpolationRegex = /^\{[\s\S]*\}$/;
34079
+
34080
+ if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
34081
+ return concat$14([node.rawName, "=", node.value]);
34082
+ }
33987
34083
  }
33988
34084
 
33989
34085
  var embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, function (code, opts) {
@@ -34045,13 +34141,13 @@ function genericPrint$5(path$$1, options, print) {
34045
34141
  var attrGroupId = Symbol("element-attr-group-id");
34046
34142
  return concat$14([group$14(concat$14([group$14(printOpeningTag(path$$1, options, print), {
34047
34143
  id: attrGroupId
34048
- }), node.children.length === 0 ? node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line$9 : "" : concat$14([forceBreakContent(node) ? breakParent$3 : "", function (childrenDoc) {
34049
- return shouldHugContent ? ifBreak$5(indent$9(childrenDoc), childrenDoc, {
34144
+ }), node.children.length === 0 ? node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line$9 : "" : concat$14([forceBreakContent(node) ? breakParent$4 : "", function (childrenDoc) {
34145
+ return shouldHugContent ? ifBreak$6(indent$9(childrenDoc), childrenDoc, {
34050
34146
  groupId: attrGroupId
34051
34147
  }) : isScriptLikeTag(node) && node.parent.type === "root" && options.parser === "vue" ? childrenDoc : indent$9(childrenDoc);
34052
- }(concat$14([shouldHugContent ? ifBreak$5(softline$7, "", {
34148
+ }(concat$14([shouldHugContent ? ifBreak$6(softline$7, "", {
34053
34149
  groupId: attrGroupId
34054
- }) : node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive ? line$9 : node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive ? dedentToRoot$2(softline$7) : softline$7, printChildren$1(path$$1, options, print)])), (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? " " : "" : shouldHugContent ? ifBreak$5(softline$7, "", {
34150
+ }) : node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive ? line$9 : node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive ? dedentToRoot$2(softline$7) : softline$7, printChildren$1(path$$1, options, print)])), (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? " " : "" : shouldHugContent ? ifBreak$6(softline$7, "", {
34055
34151
  groupId: attrGroupId
34056
34152
  }) : node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? line$9 : (node.lastChild.type === "comment" || node.lastChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) && new RegExp(`\\n\\s{${options.tabWidth * countParents(path$$1, function (n) {
34057
34153
  return n.parent && n.parent.type !== "root";
@@ -34122,7 +34218,7 @@ function printChildren$1(path$$1, options, print) {
34122
34218
  var node = path$$1.getValue();
34123
34219
 
34124
34220
  if (forceBreakChildren(node)) {
34125
- return concat$14([breakParent$3, concat$14(path$$1.map(function (childPath) {
34221
+ return concat$14([breakParent$4, concat$14(path$$1.map(function (childPath) {
34126
34222
  var childNode = childPath.getValue();
34127
34223
  var prevBetweenLine = !childNode.prev ? "" : printBetweenLine(childNode.prev, childNode);
34128
34224
  return concat$14([!prevBetweenLine ? "" : concat$14([prevBetweenLine, forceNextEmptyLine(childNode.prev) ? hardline$12 : ""]), printChild(childPath)]);
@@ -34167,7 +34263,7 @@ function printChildren$1(path$$1, options, print) {
34167
34263
  if (isTextLikeNode(childNode.prev)) {
34168
34264
  leadingParts.push(prevBetweenLine);
34169
34265
  } else {
34170
- leadingParts.push(ifBreak$5("", softline$7, {
34266
+ leadingParts.push(ifBreak$6("", softline$7, {
34171
34267
  groupId: groupIds[childIndex - 1]
34172
34268
  }));
34173
34269
  }
@@ -34764,6 +34860,15 @@ var languages$5 = [createLanguage(require$$0$31, {
34764
34860
  extensions: [".mjml" // MJML is considered XML in Linguist but it should be formatted as HTML
34765
34861
  ]
34766
34862
  }
34863
+ }), createLanguage(require$$0$31, {
34864
+ override: {
34865
+ name: "Lightning Web Components",
34866
+ since: "1.17.0",
34867
+ parsers: ["lwc"],
34868
+ vscodeLanguageIds: ["html"],
34869
+ extensions: [],
34870
+ filenames: []
34871
+ }
34767
34872
  }), createLanguage(require$$1$10, {
34768
34873
  override: {
34769
34874
  since: "1.10.0",
@@ -34798,7 +34903,7 @@ var pragma$11 = {
34798
34903
  insertPragma: insertPragma$9
34799
34904
  };
34800
34905
 
34801
- var getLast$7 = util$1.getLast;
34906
+ var getLast$6 = util$1.getLast;
34802
34907
 
34803
34908
  function getAncestorCount$1(path$$1, filter) {
34804
34909
  var counter = 0;
@@ -34887,7 +34992,7 @@ function isLastDescendantNode$1(path$$1) {
34887
34992
  }
34888
34993
 
34889
34994
  function getLastDescendantNode$2(node) {
34890
- return "children" in node && node.children.length !== 0 ? getLastDescendantNode$2(getLast$7(node.children)) : node;
34995
+ return "children" in node && node.children.length !== 0 ? getLastDescendantNode$2(getLast$6(node.children)) : node;
34891
34996
  }
34892
34997
 
34893
34998
  function isPrettierIgnore$2(comment) {
@@ -34899,10 +35004,10 @@ function hasPrettierIgnore$5(path$$1) {
34899
35004
 
34900
35005
  if (node.type === "documentBody") {
34901
35006
  var document = path$$1.getParentNode();
34902
- return hasEndComments$1(document.head) && isPrettierIgnore$2(getLast$7(document.head.endComments));
35007
+ return hasEndComments$1(document.head) && isPrettierIgnore$2(getLast$6(document.head.endComments));
34903
35008
  }
34904
35009
 
34905
- return hasLeadingComments$1(node) && isPrettierIgnore$2(getLast$7(node.leadingComments));
35010
+ return hasLeadingComments$1(node) && isPrettierIgnore$2(getLast$6(node.leadingComments));
34906
35011
  }
34907
35012
 
34908
35013
  function isEmptyNode$1(node) {
@@ -35002,7 +35107,7 @@ function getFlowScalarLineContents$1(nodeType, content, options) {
35002
35107
  return lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent);
35003
35108
  }).reduce(function (reduced, lineContentWords, index) {
35004
35109
  return index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !( // trailing backslash in quoteDouble should be preserved
35005
- nodeType === "quoteDouble" && getLast$7(getLast$7(reduced)).endsWith("\\")) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
35110
+ nodeType === "quoteDouble" && getLast$6(getLast$6(reduced)).endsWith("\\")) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
35006
35111
  }, []).map(function (lineContentWords) {
35007
35112
  return options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords;
35008
35113
  });
@@ -35030,11 +35135,11 @@ function getBlockValueLineContents$1(node, _ref) {
35030
35135
  return removeUnnecessaryTrailingNewlines(rawLineContents.map(function (lineContent) {
35031
35136
  return lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent);
35032
35137
  }).reduce(function (reduced, lineContentWords, index) {
35033
- return index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !/^\s/.test(lineContentWords[0]) && !/^\s|\s$/.test(getLast$7(reduced)) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
35138
+ return index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !/^\s/.test(lineContentWords[0]) && !/^\s|\s$/.test(getLast$6(reduced)) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
35034
35139
  }, []).map(function (lineContentWords) {
35035
35140
  return lineContentWords.reduce(function (reduced, word) {
35036
35141
  return (// disallow trailing spaces
35037
- reduced.length !== 0 && /\s$/.test(getLast$7(reduced)) ? reduced.concat(reduced.pop() + " " + word) : reduced.concat(word)
35142
+ reduced.length !== 0 && /\s$/.test(getLast$6(reduced)) ? reduced.concat(reduced.pop() + " " + word) : reduced.concat(word)
35038
35143
  );
35039
35144
  }, []);
35040
35145
  }).map(function (lineContentWords) {
@@ -35043,7 +35148,7 @@ function getBlockValueLineContents$1(node, _ref) {
35043
35148
 
35044
35149
  function removeUnnecessaryTrailingNewlines(lineContents) {
35045
35150
  if (node.chomping === "keep") {
35046
- return getLast$7(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
35151
+ return getLast$6(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
35047
35152
  }
35048
35153
 
35049
35154
  var trailingNewlineCount = 0;
@@ -35062,7 +35167,7 @@ function getBlockValueLineContents$1(node, _ref) {
35062
35167
  }
35063
35168
 
35064
35169
  var utils$12 = {
35065
- getLast: getLast$7,
35170
+ getLast: getLast$6,
35066
35171
  getAncestorCount: getAncestorCount$1,
35067
35172
  isNode: isNode$2,
35068
35173
  isEmptyNode: isEmptyNode$1,
@@ -35086,7 +35191,7 @@ var isPragma = pragma$11.isPragma;
35086
35191
  var getAncestorCount = utils$12.getAncestorCount;
35087
35192
  var getBlockValueLineContents = utils$12.getBlockValueLineContents;
35088
35193
  var getFlowScalarLineContents = utils$12.getFlowScalarLineContents;
35089
- var getLast$6 = utils$12.getLast;
35194
+ var getLast$5 = utils$12.getLast;
35090
35195
  var getLastDescendantNode$1 = utils$12.getLastDescendantNode;
35091
35196
  var hasLeadingComments = utils$12.hasLeadingComments;
35092
35197
  var hasMiddleComments = utils$12.hasMiddleComments;
@@ -35102,14 +35207,14 @@ var defineShortcut = utils$12.defineShortcut;
35102
35207
  var mapNode = utils$12.mapNode;
35103
35208
  var docBuilders$3 = doc.builders;
35104
35209
  var conditionalGroup$2 = docBuilders$3.conditionalGroup;
35105
- var breakParent$4 = docBuilders$3.breakParent;
35210
+ var breakParent$5 = docBuilders$3.breakParent;
35106
35211
  var concat$17 = docBuilders$3.concat;
35107
35212
  var dedent$4 = docBuilders$3.dedent;
35108
35213
  var dedentToRoot$3 = docBuilders$3.dedentToRoot;
35109
35214
  var fill$6 = docBuilders$3.fill;
35110
35215
  var group$16 = docBuilders$3.group;
35111
35216
  var hardline$13 = docBuilders$3.hardline;
35112
- var ifBreak$7 = docBuilders$3.ifBreak;
35217
+ var ifBreak$8 = docBuilders$3.ifBreak;
35113
35218
  var join$12 = docBuilders$3.join;
35114
35219
  var line$11 = docBuilders$3.line;
35115
35220
  var lineSuffix$2 = docBuilders$3.lineSuffix;
@@ -35163,7 +35268,7 @@ function genericPrint$6(path$$1, options, print) {
35163
35268
  var tag = !node.tag ? "" : path$$1.call(print, "tag");
35164
35269
  var anchor = !node.anchor ? "" : path$$1.call(print, "anchor");
35165
35270
  var nextEmptyLine = isNode$1(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode(path$$1) ? printNextEmptyLine(path$$1, options.originalText) : "";
35166
- return concat$17([node.type !== "mappingValue" && hasLeadingComments(node) ? concat$17([join$12(hardline$13, path$$1.map(print, "leadingComments")), hardline$13]) : "", tag, tag && anchor ? " " : "", anchor, tag || anchor ? isNode$1(node, ["sequence", "mapping"]) && !hasMiddleComments(node) ? hardline$13 : " " : "", hasMiddleComments(node) ? concat$17([node.middleComments.length === 1 ? "" : hardline$13, join$12(hardline$13, path$$1.map(print, "middleComments")), hardline$13]) : "", hasPrettierIgnore$4(path$$1) ? concat$17(replaceEndOfLineWith$3(options.originalText.slice(node.position.start.offset, node.position.end.offset), literalline$7)) : group$16(_print(node, parentNode, path$$1, options, print)), hasTrailingComment$1(node) && !isNode$1(node, ["document", "documentHead"]) ? lineSuffix$2(concat$17([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path$$1.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent$4, path$$1.call(print, "trailingComment")])) : "", nextEmptyLine, hasEndComments(node) && !isNode$1(node, ["documentHead", "documentBody"]) ? align$3(node.type === "sequenceItem" ? 2 : 0, concat$17([hardline$13, join$12(hardline$13, path$$1.map(print, "endComments"))])) : ""]);
35271
+ return concat$17([node.type !== "mappingValue" && hasLeadingComments(node) ? concat$17([join$12(hardline$13, path$$1.map(print, "leadingComments")), hardline$13]) : "", tag, tag && anchor ? " " : "", anchor, tag || anchor ? isNode$1(node, ["sequence", "mapping"]) && !hasMiddleComments(node) ? hardline$13 : " " : "", hasMiddleComments(node) ? concat$17([node.middleComments.length === 1 ? "" : hardline$13, join$12(hardline$13, path$$1.map(print, "middleComments")), hardline$13]) : "", hasPrettierIgnore$4(path$$1) ? concat$17(replaceEndOfLineWith$3(options.originalText.slice(node.position.start.offset, node.position.end.offset), literalline$7)) : group$16(_print(node, parentNode, path$$1, options, print)), hasTrailingComment$1(node) && !isNode$1(node, ["document", "documentHead"]) ? lineSuffix$2(concat$17([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path$$1.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent$5, path$$1.call(print, "trailingComment")])) : "", nextEmptyLine, hasEndComments(node) && !isNode$1(node, ["documentHead", "documentBody"]) ? align$3(node.type === "sequenceItem" ? 2 : 0, concat$17([hardline$13, join$12(hardline$13, path$$1.map(print, "endComments"))])) : ""]);
35167
35272
  }
35168
35273
 
35169
35274
  function _print(node, parentNode, path$$1, options, print) {
@@ -35299,9 +35404,9 @@ function _print(node, parentNode, path$$1, options, print) {
35299
35404
  return forceExplicitKey ? concat$17(["? ", align$3(2, key), hardline$13, join$12("", path$$1.map(print, "value", "leadingComments").map(function (comment) {
35300
35405
  return concat$17([comment, hardline$13]);
35301
35406
  })), ": ", align$3(2, value)]) : // force singleline
35302
- isSingleLineNode(node.key.content) && !hasLeadingComments(node.key.content) && !hasMiddleComments(node.key.content) && !hasTrailingComment$1(node.key.content) && !hasEndComments(node.key) && !hasLeadingComments(node.value.content) && !hasMiddleComments(node.value.content) && !hasEndComments(node.value) && isAbsolutelyPrintedAsSingleLineNode(node.value.content, options) ? concat$17([key, needsSpaceInFrontOfMappingValue(node) ? " " : "", ": ", value]) : conditionalGroup$2([concat$17([group$16(concat$17([ifBreak$7("? "), group$16(align$3(2, key), {
35407
+ isSingleLineNode(node.key.content) && !hasLeadingComments(node.key.content) && !hasMiddleComments(node.key.content) && !hasTrailingComment$1(node.key.content) && !hasEndComments(node.key) && !hasLeadingComments(node.value.content) && !hasMiddleComments(node.value.content) && !hasEndComments(node.value) && isAbsolutelyPrintedAsSingleLineNode(node.value.content, options) ? concat$17([key, needsSpaceInFrontOfMappingValue(node) ? " " : "", ": ", value]) : conditionalGroup$2([concat$17([group$16(concat$17([ifBreak$8("? "), group$16(align$3(2, key), {
35303
35408
  id: groupId
35304
- })])), ifBreak$7(concat$17([hardline$13, ": ", align$3(2, value)]), indent(concat$17([needsSpaceInFrontOfMappingValue(node) ? " " : "", ":", hasLeadingComments(node.value.content) || hasEndComments(node.value) && node.value.content && !isNode$1(node.value.content, ["mapping", "sequence"]) || parentNode.type === "mapping" && hasTrailingComment$1(node.key.content) && isInlineNode(node.value.content) || isNode$1(node.value.content, ["mapping", "sequence"]) && node.value.content.tag === null && node.value.content.anchor === null ? hardline$13 : !node.value.content ? "" : line$11, value])), {
35409
+ })])), ifBreak$8(concat$17([hardline$13, ": ", align$3(2, value)]), indent(concat$17([needsSpaceInFrontOfMappingValue(node) ? " " : "", ":", hasLeadingComments(node.value.content) || hasEndComments(node.value) && node.value.content && !isNode$1(node.value.content, ["mapping", "sequence"]) || parentNode.type === "mapping" && hasTrailingComment$1(node.key.content) && isInlineNode(node.value.content) || isNode$1(node.value.content, ["mapping", "sequence"]) && node.value.content.tag === null && node.value.content.anchor === null ? hardline$13 : !node.value.content ? "" : line$11, value])), {
35305
35410
  groupId
35306
35411
  })])]);
35307
35412
  }
@@ -35315,11 +35420,11 @@ function _print(node, parentNode, path$$1, options, print) {
35315
35420
 
35316
35421
  var isLastItemEmptyMappingItem = node.children.length !== 0 && function (lastItem) {
35317
35422
  return lastItem.type === "flowMappingItem" && isEmptyNode(lastItem.key) && isEmptyNode(lastItem.value);
35318
- }(getLast$6(node.children));
35423
+ }(getLast$5(node.children));
35319
35424
 
35320
35425
  return concat$17([openMarker, indent(concat$17([bracketSpacing, concat$17(path$$1.map(function (childPath, index) {
35321
35426
  return concat$17([print(childPath), index === node.children.length - 1 ? "" : concat$17([",", line$11, node.children[index].position.start.line !== node.children[index + 1].position.start.line ? printNextEmptyLine(childPath, options.originalText) : ""])]);
35322
- }, "children")), ifBreak$7(",", "")])), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker]);
35427
+ }, "children")), ifBreak$8(",", "")])), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker]);
35323
35428
  }
35324
35429
 
35325
35430
  case "flowSequenceItem":
@@ -35737,6 +35842,11 @@ languageMarkdown, {
35737
35842
  // Angular
35738
35843
  get angular() {
35739
35844
  return require("./parser-html").parsers.angular;
35845
+ },
35846
+
35847
+ // Lightning Web Components
35848
+ get lwc() {
35849
+ return require("./parser-html").parsers.lwc;
35740
35850
  }
35741
35851
 
35742
35852
  }
@@ -35810,12 +35920,14 @@ function loadPlugins(plugins, pluginSearchDirs) {
35810
35920
  });
35811
35921
  var externalAutoLoadPluginInfos = pluginSearchDirs.map(function (pluginSearchDir) {
35812
35922
  var resolvedPluginSearchDir = path.resolve(process.cwd(), pluginSearchDir);
35923
+ var nodeModulesDir = path.resolve(resolvedPluginSearchDir, "node_modules"); // In some fringe cases (ex: files "mounted" as virtual directories), the
35924
+ // isDirectory(resolvedPluginSearchDir) check might be false even though
35925
+ // the node_modules actually exists.
35813
35926
 
35814
- if (!isDirectory(resolvedPluginSearchDir)) {
35927
+ if (!isDirectory(nodeModulesDir) && !isDirectory(resolvedPluginSearchDir)) {
35815
35928
  throw new Error(`${pluginSearchDir} does not exist or is not a directory`);
35816
35929
  }
35817
35930
 
35818
- var nodeModulesDir = path.resolve(resolvedPluginSearchDir, "node_modules");
35819
35931
  return findPluginsInNodeModules(nodeModulesDir).map(function (pluginName) {
35820
35932
  return {
35821
35933
  name: pluginName,
@@ -35836,7 +35948,7 @@ function loadPlugins(plugins, pluginSearchDirs) {
35836
35948
  }
35837
35949
 
35838
35950
  function findPluginsInNodeModules(nodeModulesDir) {
35839
- var pluginPackageJsonPaths = globby.sync(["prettier-plugin-*/package.json", "@prettier/plugin-*/package.json"], {
35951
+ var pluginPackageJsonPaths = globby.sync(["prettier-plugin-*/package.json", "@*/prettier-plugin-*/package.json", "@prettier/plugin-*/package.json"], {
35840
35952
  cwd: nodeModulesDir
35841
35953
  });
35842
35954
  return pluginPackageJsonPaths.map(path.dirname);
@@ -42222,6 +42334,13 @@ var resolveConfig_1 = createCommonjsModule(function (module) {
42222
42334
  cache: opts.cache,
42223
42335
  transform: function transform(result) {
42224
42336
  if (result && result.config) {
42337
+ if (typeof result.config === "string") {
42338
+ var modulePath = resolve$1.sync(result.config, {
42339
+ basedir: path.dirname(result.filepath)
42340
+ });
42341
+ result.config = require(modulePath);
42342
+ }
42343
+
42225
42344
  if (typeof result.config !== "object") {
42226
42345
  throw new Error(`Config is only allowed to be an object, ` + `but received ${typeof result.config} in "${result.filepath}"`);
42227
42346
  }
@@ -43863,7 +43982,7 @@ function formatStdin(context) {
43863
43982
 
43864
43983
  writeOutput(context, format$1(context, input, options$$2), options$$2);
43865
43984
  } catch (error) {
43866
- handleError(context, "stdin", error);
43985
+ handleError(context, relativeFilepath || "stdin", error);
43867
43986
  }
43868
43987
  });
43869
43988
  }