prettier 3.0.0-alpha.6 → 3.0.0-alpha.7-for-vscode

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.
Files changed (56) hide show
  1. package/LICENSE +17 -17
  2. package/bin/prettier.cjs +0 -0
  3. package/doc.d.ts +2 -10
  4. package/doc.js +55 -246
  5. package/doc.mjs +51 -246
  6. package/index.cjs +20567 -478
  7. package/index.d.ts +26 -8
  8. package/index.mjs +5920 -20834
  9. package/internal/cli.mjs +486 -478
  10. package/internal/internal.cjs +6430 -0
  11. package/internal/{third-party.mjs → internal.mjs} +19 -14
  12. package/package.json +40 -29
  13. package/plugins/acorn.d.ts +6 -0
  14. package/plugins/acorn.js +13 -0
  15. package/plugins/acorn.mjs +13 -0
  16. package/plugins/angular.d.ts +5 -9
  17. package/plugins/angular.js +2 -2
  18. package/plugins/angular.mjs +2 -2
  19. package/plugins/babel.d.ts +14 -14
  20. package/plugins/babel.js +11 -11
  21. package/plugins/babel.mjs +11 -11
  22. package/plugins/estree.d.ts +0 -0
  23. package/plugins/estree.js +35 -0
  24. package/plugins/estree.mjs +35 -0
  25. package/plugins/flow.d.ts +2 -6
  26. package/plugins/flow.js +20 -20
  27. package/plugins/flow.mjs +20 -20
  28. package/plugins/glimmer.d.ts +2 -6
  29. package/plugins/glimmer.js +22 -17
  30. package/plugins/glimmer.mjs +22 -17
  31. package/plugins/graphql.d.ts +2 -6
  32. package/plugins/graphql.js +16 -7
  33. package/plugins/graphql.mjs +16 -7
  34. package/plugins/html.d.ts +5 -9
  35. package/plugins/html.js +19 -17
  36. package/plugins/html.mjs +19 -17
  37. package/plugins/markdown.d.ts +4 -8
  38. package/plugins/markdown.js +54 -33
  39. package/plugins/markdown.mjs +54 -33
  40. package/plugins/meriyah.d.ts +2 -6
  41. package/plugins/meriyah.js +5 -5
  42. package/plugins/meriyah.mjs +5 -5
  43. package/plugins/postcss.d.ts +4 -8
  44. package/plugins/postcss.js +45 -32
  45. package/plugins/postcss.mjs +45 -32
  46. package/plugins/typescript.d.ts +2 -6
  47. package/plugins/typescript.js +24 -20
  48. package/plugins/typescript.mjs +24 -20
  49. package/plugins/yaml.d.ts +2 -6
  50. package/plugins/yaml.js +130 -117
  51. package/plugins/yaml.mjs +130 -117
  52. package/standalone.js +27 -90
  53. package/standalone.mjs +27 -90
  54. package/plugins/acorn-and-espree.d.ts +0 -10
  55. package/plugins/acorn-and-espree.js +0 -13
  56. package/plugins/acorn-and-espree.mjs +0 -13
package/index.d.ts CHANGED
@@ -8,10 +8,10 @@
8
8
  // exported module.
9
9
  export {};
10
10
 
11
- import { builders, debug, printer, utils } from "./doc.js";
11
+ import { builders, printer, utils } from "./doc.js";
12
12
 
13
13
  export namespace doc {
14
- export { builders, debug, printer, utils };
14
+ export { builders, printer, utils };
15
15
  }
16
16
 
17
17
  // This utility is here to handle the case where you have an explicit union
@@ -477,11 +477,19 @@ export interface Printer<T = any> {
477
477
  ): Doc;
478
478
  embed?:
479
479
  | ((
480
- path: AstPath<T>,
481
- print: (path: AstPath<T>) => Doc,
482
- textToDoc: (text: string, options: Options) => Doc,
483
- options: ParserOptions<T>
484
- ) => Doc | null)
480
+ path: AstPath,
481
+ options: Options
482
+ ) =>
483
+ | ((
484
+ textToDoc: (text: string, options: Options) => Promise<Doc>,
485
+ print: (
486
+ selector?: string | number | Array<string | number> | AstPath
487
+ ) => Doc,
488
+ path: AstPath,
489
+ options: Options
490
+ ) => Promise<Doc | undefined> | Doc | undefined)
491
+ | Doc
492
+ | null)
485
493
  | undefined;
486
494
  insertPragma?: (text: string) => string;
487
495
  /**
@@ -497,6 +505,16 @@ export interface Printer<T = any> {
497
505
  printComment?:
498
506
  | ((commentPath: AstPath<T>, options: ParserOptions<T>) => Doc)
499
507
  | undefined;
508
+ /**
509
+ * By default, Prettier searches all object properties (except for a few predefined ones) of each node recursively.
510
+ * This function can be provided to override that behavior.
511
+ * @param node The node whose children should be returned.
512
+ * @param options Current options.
513
+ * @returns `[]` if the node has no children or `undefined` to fall back on the default behavior.
514
+ */
515
+ getCommentChildNodes?:
516
+ | ((node: T, options: ParserOptions<T>) => T[] | undefined)
517
+ | undefined;
500
518
  handleComments?:
501
519
  | {
502
520
  ownLine?:
@@ -767,7 +785,7 @@ export interface SupportInfo {
767
785
  }
768
786
 
769
787
  export interface FileInfoOptions {
770
- ignorePath?: string | undefined;
788
+ ignorePath?: string | string[] | undefined;
771
789
  withNodeModules?: boolean | undefined;
772
790
  plugins?: string[] | undefined;
773
791
  resolveConfig?: boolean | undefined;