prettier 2.6.1 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1809,14 +1809,43 @@ var require_array = __commonJS2({
1809
1809
  }
1810
1810
  });
1811
1811
  var require_escape_string_regexp = __commonJS2({
1812
- "node_modules/escape-string-regexp/index.js"(exports2, module2) {
1813
- "use strict";
1814
- module2.exports = (string) => {
1812
+ "vendors/escape-string-regexp.js"(exports2, module2) {
1813
+ var __defProp2 = Object.defineProperty;
1814
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1815
+ var __getOwnPropNames22 = Object.getOwnPropertyNames;
1816
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1817
+ var __export2 = (target, all) => {
1818
+ for (var name in all)
1819
+ __defProp2(target, name, {
1820
+ get: all[name],
1821
+ enumerable: true
1822
+ });
1823
+ };
1824
+ var __copyProps2 = (to, from, except, desc) => {
1825
+ if (from && typeof from === "object" || typeof from === "function") {
1826
+ for (let key of __getOwnPropNames22(from))
1827
+ if (!__hasOwnProp2.call(to, key) && key !== except)
1828
+ __defProp2(to, key, {
1829
+ get: () => from[key],
1830
+ enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable
1831
+ });
1832
+ }
1833
+ return to;
1834
+ };
1835
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", {
1836
+ value: true
1837
+ }), mod);
1838
+ var escape_string_regexp_exports = {};
1839
+ __export2(escape_string_regexp_exports, {
1840
+ default: () => escapeStringRegexp
1841
+ });
1842
+ module2.exports = __toCommonJS2(escape_string_regexp_exports);
1843
+ function escapeStringRegexp(string) {
1815
1844
  if (typeof string !== "string") {
1816
1845
  throw new TypeError("Expected a string");
1817
1846
  }
1818
1847
  return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
1819
- };
1848
+ }
1820
1849
  }
1821
1850
  });
1822
1851
  var require_get_last = __commonJS2({
@@ -3004,7 +3033,9 @@ var require_get_next_non_space_non_comment_character_index_with_start_index = __
3004
3033
  var require_util = __commonJS2({
3005
3034
  "src/common/util.js"(exports2, module2) {
3006
3035
  "use strict";
3007
- var escapeStringRegexp = require_escape_string_regexp();
3036
+ var {
3037
+ default: escapeStringRegexp
3038
+ } = require_escape_string_regexp();
3008
3039
  var getLast = require_get_last();
3009
3040
  var {
3010
3041
  getSupportInfo: getSupportInfo2
@@ -11708,11 +11739,11 @@ var require_micromatch = __commonJS2({
11708
11739
  options.onResult(state);
11709
11740
  items.push(state.output);
11710
11741
  };
11711
- let matches = micromatch(list, patterns, Object.assign(Object.assign({}, options), {}, {
11742
+ let matches = new Set(micromatch(list, patterns, Object.assign(Object.assign({}, options), {}, {
11712
11743
  onResult
11713
- }));
11744
+ })));
11714
11745
  for (let item of items) {
11715
- if (!matches.includes(item)) {
11746
+ if (!matches.has(item)) {
11716
11747
  result.add(item);
11717
11748
  }
11718
11749
  }
@@ -32845,8 +32876,11 @@ var require_printer_postcss = __commonJS2({
32845
32876
  parts[1] = group(parts[1]);
32846
32877
  return group(dedent(printed2));
32847
32878
  }
32848
- if (!isLast && child.type === "value-comma_group" && child.groups && child.groups[0].type !== "value-paren_group" && isNextLineEmpty(options.originalText, getLast(child.groups), locEnd)) {
32849
- printed2.push(hardline);
32879
+ if (!isLast && child.type === "value-comma_group" && isNonEmptyArray(child.groups)) {
32880
+ const last = getLast(child.groups);
32881
+ if (last.source && isNextLineEmpty(options.originalText, last, locEnd)) {
32882
+ printed2.push(hardline);
32883
+ }
32850
32884
  }
32851
32885
  return printed2;
32852
32886
  }, "groups"))]), ifBreak(!isLastItemComment && isSCSS(options.parser, options.originalText) && isSCSSMapItem && shouldPrintComma(options) ? "," : ""), softline, node.close ? print("close") : ""], {
@@ -33102,14 +33136,18 @@ var require_clean3 = __commonJS2({
33102
33136
  }
33103
33137
  });
33104
33138
  var require_html_void_elements = __commonJS2({
33105
- "node_modules/html-void-elements/index.json"(exports2, module2) {
33106
- module2.exports = ["area", "base", "basefont", "bgsound", "br", "col", "command", "embed", "frame", "hr", "image", "img", "input", "isindex", "keygen", "link", "menuitem", "meta", "nextid", "param", "source", "track", "wbr"];
33139
+ "vendors/html-void-elements.json"(exports2, module2) {
33140
+ module2.exports = {
33141
+ htmlVoidElements: ["area", "base", "basefont", "bgsound", "br", "col", "command", "embed", "frame", "hr", "image", "img", "input", "isindex", "keygen", "link", "menuitem", "meta", "nextid", "param", "source", "track", "wbr"]
33142
+ };
33107
33143
  }
33108
33144
  });
33109
33145
  var require_utils9 = __commonJS2({
33110
33146
  "src/language-handlebars/utils.js"(exports2, module2) {
33111
33147
  "use strict";
33112
- var htmlVoidElements = require_html_void_elements();
33148
+ var {
33149
+ htmlVoidElements
33150
+ } = require_html_void_elements();
33113
33151
  var getLast = require_get_last();
33114
33152
  function isLastNodeOfSiblings(path) {
33115
33153
  const node = path.getValue();
@@ -33809,10 +33847,10 @@ var require_printer_graphql = __commonJS2({
33809
33847
  return ["fragment ", print("name"), isNonEmptyArray(node.variableDefinitions) ? group(["(", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "variableDefinitions"))]), softline, ")"]) : "", " on ", print("typeCondition"), printDirectives(path, print, node), " ", print("selectionSet")];
33810
33848
  }
33811
33849
  case "SelectionSet": {
33812
- return ["{", indent([hardline, join(hardline, path.call((selectionsPath) => printSequence(selectionsPath, options, print), "selections"))]), hardline, "}"];
33850
+ return ["{", indent([hardline, join(hardline, printSequence(path, options, print, "selections"))]), hardline, "}"];
33813
33851
  }
33814
33852
  case "Field": {
33815
- return group([node.alias ? [print("alias"), ": "] : "", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], path.call((argsPath) => printSequence(argsPath, options, print), "arguments"))]), softline, ")"]) : "", printDirectives(path, print, node), node.selectionSet ? " " : "", print("selectionSet")]);
33853
+ return group([node.alias ? [print("alias"), ": "] : "", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : "", printDirectives(path, print, node), node.selectionSet ? " " : "", print("selectionSet")]);
33816
33854
  }
33817
33855
  case "Name": {
33818
33856
  return node.value;
@@ -33848,7 +33886,7 @@ var require_printer_graphql = __commonJS2({
33848
33886
  return [print("name"), ": ", print("value")];
33849
33887
  }
33850
33888
  case "Directive": {
33851
- return ["@", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], path.call((argsPath) => printSequence(argsPath, options, print), "arguments"))]), softline, ")"]) : ""];
33889
+ return ["@", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : ""];
33852
33890
  }
33853
33891
  case "NamedType": {
33854
33892
  return print("name");
@@ -33858,17 +33896,17 @@ var require_printer_graphql = __commonJS2({
33858
33896
  }
33859
33897
  case "ObjectTypeExtension":
33860
33898
  case "ObjectTypeDefinition": {
33861
- return [print("description"), node.description ? hardline : "", node.kind === "ObjectTypeExtension" ? "extend " : "", "type ", print("name"), node.interfaces.length > 0 ? [" implements ", ...printInterfaces(path, options, print)] : "", printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, path.call((fieldsPath) => printSequence(fieldsPath, options, print), "fields"))]), hardline, "}"] : ""];
33899
+ return [print("description"), node.description ? hardline : "", node.kind === "ObjectTypeExtension" ? "extend " : "", "type ", print("name"), node.interfaces.length > 0 ? [" implements ", ...printInterfaces(path, options, print)] : "", printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "fields"))]), hardline, "}"] : ""];
33862
33900
  }
33863
33901
  case "FieldDefinition": {
33864
- return [print("description"), node.description ? hardline : "", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], path.call((argsPath) => printSequence(argsPath, options, print), "arguments"))]), softline, ")"]) : "", ": ", print("type"), printDirectives(path, print, node)];
33902
+ return [print("description"), node.description ? hardline : "", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : "", ": ", print("type"), printDirectives(path, print, node)];
33865
33903
  }
33866
33904
  case "DirectiveDefinition": {
33867
- return [print("description"), node.description ? hardline : "", "directive ", "@", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], path.call((argsPath) => printSequence(argsPath, options, print), "arguments"))]), softline, ")"]) : "", node.repeatable ? " repeatable" : "", " on ", join(" | ", path.map(print, "locations"))];
33905
+ return [print("description"), node.description ? hardline : "", "directive ", "@", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : "", node.repeatable ? " repeatable" : "", " on ", join(" | ", path.map(print, "locations"))];
33868
33906
  }
33869
33907
  case "EnumTypeExtension":
33870
33908
  case "EnumTypeDefinition": {
33871
- return [print("description"), node.description ? hardline : "", node.kind === "EnumTypeExtension" ? "extend " : "", "enum ", print("name"), printDirectives(path, print, node), node.values.length > 0 ? [" {", indent([hardline, join(hardline, path.call((valuesPath) => printSequence(valuesPath, options, print), "values"))]), hardline, "}"] : ""];
33909
+ return [print("description"), node.description ? hardline : "", node.kind === "EnumTypeExtension" ? "extend " : "", "enum ", print("name"), printDirectives(path, print, node), node.values.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "values"))]), hardline, "}"] : ""];
33872
33910
  }
33873
33911
  case "EnumValueDefinition": {
33874
33912
  return [print("description"), node.description ? hardline : "", print("name"), printDirectives(path, print, node)];
@@ -33878,17 +33916,17 @@ var require_printer_graphql = __commonJS2({
33878
33916
  }
33879
33917
  case "InputObjectTypeExtension":
33880
33918
  case "InputObjectTypeDefinition": {
33881
- return [print("description"), node.description ? hardline : "", node.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", print("name"), printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, path.call((fieldsPath) => printSequence(fieldsPath, options, print), "fields"))]), hardline, "}"] : ""];
33919
+ return [print("description"), node.description ? hardline : "", node.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", print("name"), printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "fields"))]), hardline, "}"] : ""];
33882
33920
  }
33883
33921
  case "SchemaDefinition": {
33884
- return [print("description"), node.description ? hardline : "", "schema", printDirectives(path, print, node), " {", node.operationTypes.length > 0 ? indent([hardline, join(hardline, path.call((opsPath) => printSequence(opsPath, options, print), "operationTypes"))]) : "", hardline, "}"];
33922
+ return [print("description"), node.description ? hardline : "", "schema", printDirectives(path, print, node), " {", node.operationTypes.length > 0 ? indent([hardline, join(hardline, printSequence(path, options, print, "operationTypes"))]) : "", hardline, "}"];
33885
33923
  }
33886
33924
  case "OperationTypeDefinition": {
33887
33925
  return [print("operation"), ": ", print("type")];
33888
33926
  }
33889
33927
  case "InterfaceTypeExtension":
33890
33928
  case "InterfaceTypeDefinition": {
33891
- return [print("description"), node.description ? hardline : "", node.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", print("name"), node.interfaces.length > 0 ? [" implements ", ...printInterfaces(path, options, print)] : "", printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, path.call((fieldsPath) => printSequence(fieldsPath, options, print), "fields"))]), hardline, "}"] : ""];
33929
+ return [print("description"), node.description ? hardline : "", node.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", print("name"), node.interfaces.length > 0 ? [" implements ", ...printInterfaces(path, options, print)] : "", printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "fields"))]), hardline, "}"] : ""];
33892
33930
  }
33893
33931
  case "FragmentSpread": {
33894
33932
  return ["...", print("name"), printDirectives(path, print, node)];
@@ -33924,15 +33962,14 @@ var require_printer_graphql = __commonJS2({
33924
33962
  }
33925
33963
  return [" ", group(indent([softline, printed]))];
33926
33964
  }
33927
- function printSequence(sequencePath, options, print) {
33928
- const count = sequencePath.getValue().length;
33929
- return sequencePath.map((path, i) => {
33965
+ function printSequence(path, options, print, property) {
33966
+ return path.map((path2, index, sequence) => {
33930
33967
  const printed = print();
33931
- if (isNextLineEmpty(options.originalText, path.getValue(), locEnd) && i < count - 1) {
33968
+ if (index < sequence.length - 1 && isNextLineEmpty(options.originalText, path2.getValue(), locEnd)) {
33932
33969
  return [printed, hardline];
33933
33970
  }
33934
33971
  return printed;
33935
- });
33972
+ }, property);
33936
33973
  }
33937
33974
  function canAttachComment(node) {
33938
33975
  return node.kind && node.kind !== "Comment";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "Prettier is an opinionated code formatter",
5
5
  "bin": "./bin-prettier.js",
6
6
  "repository": "prettier/prettier",