oxfmt 0.35.0 → 0.37.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.
Files changed (43) hide show
  1. package/README.md +2 -2
  2. package/dist/{acorn-DSYDYt2u.js → acorn-BnWlLI9w.js} +1 -2
  3. package/dist/{angular-DdA9f8ZK.js → angular-BjdVY6ry.js} +3 -5
  4. package/dist/{apis-KSwODFyo.js → apis-BoXLniqX.js} +42 -14
  5. package/dist/babel-cHKEVC-N.js +2 -0
  6. package/dist/{bindings-Bg9JnrLc.js → bindings-Cpav0PNl.js} +27 -29
  7. package/dist/{chunk-DSjvVL_1-K7gBHu1i.js → chunk-DSjvVL_1-BYdvZw3N.js} +1 -3
  8. package/dist/chunk-DrSxFLj_.js +14 -0
  9. package/dist/cli-worker.d.ts +609 -15
  10. package/dist/cli-worker.js +2 -3
  11. package/dist/cli.js +20 -17
  12. package/dist/{dist-DQgkZSFc.js → dist-BxX-OKHo.js} +14 -18
  13. package/dist/{estree-DBPlpXot.js → estree-BdH1ynKb.js} +1 -2
  14. package/dist/{flow-DZRswbuH.js → flow-JTvJzd2b.js} +1 -2
  15. package/dist/{glimmer-B28TNYIB.js → glimmer-Dj-rhc3H.js} +1 -2
  16. package/dist/{graphql-3p9xuuKy.js → graphql-C66DjsEv.js} +1 -2
  17. package/dist/{html-D2VbMQAT.js → html-cr_GTtzg.js} +1 -2
  18. package/dist/index.d.ts +425 -76
  19. package/dist/index.js +14 -10
  20. package/dist/{init-BlnymtNS.js → init-BbKOMZ57.js} +2 -4
  21. package/dist/{jiti-Bb1dT6Cw-CP1_dUF7.js → jiti-Bb1dT6Cw-BzC3jhZX.js} +2 -4
  22. package/dist/{markdown-DdJpriJP.js → markdown-4I9EsAQD.js} +1 -2
  23. package/dist/{meriyah-CQnZTN4N.js → meriyah-Dyll-d_f.js} +1 -2
  24. package/dist/{migrate-biome-B4fq26fI.js → migrate-biome-BMqs7-eg.js} +2 -4
  25. package/dist/{migrate-prettier-CMmmGHbr.js → migrate-prettier-BfVrZTrL.js} +3 -5
  26. package/dist/{postcss-D79LfgjO.js → postcss-Cy4xGDrs.js} +2 -3
  27. package/dist/{prettier-DIVejRqd.js → prettier-DYJRSbN0.js} +19 -22
  28. package/dist/prettier-plugin-oxfmt-DGn95w-c.js +59 -0
  29. package/dist/{resolve-pWjAK-4f-YzJRPmwZ.js → resolve-pWjAK-4f-C1Z6M6r2.js} +2 -4
  30. package/dist/{shared-BhroZgjV.js → shared-BTEY2VsW.js} +1 -3
  31. package/dist/{sorter-BZkvDMjt-CiG199np.js → sorter-BZkvDMjt-n6dGttqp.js} +7 -9
  32. package/dist/sorter-D7zO39b5.js +3 -0
  33. package/dist/{typescript-D5lCjM2U.js → typescript-8enly1_u.js} +1 -2
  34. package/dist/{utils-D8dQkKEd-bSmL59ud.js → utils-D8dQkKEd-BtAa7w-M.js} +1 -3
  35. package/dist/{v3-D-mr2VVh-DAVD4LOh.js → v3-D-mr2VVh-FqDpKDIq.js} +4 -6
  36. package/dist/{v4-C-HWEQJm-DOWhMvfI.js → v4-C-HWEQJm-DL_vfdDs.js} +4 -6
  37. package/dist/{yaml-jtj0ZWQC.js → yaml-B6CM-Uf_.js} +1 -2
  38. package/package.json +21 -20
  39. package/dist/babel-CmMxKXKi.js +0 -3
  40. package/dist/chunk-DpReBE2K.js +0 -20
  41. package/dist/index-BNhsnuYk.d.ts +0 -577
  42. package/dist/prettier-plugin-oxfmt-B4H9aKXO.js +0 -47
  43. package/dist/sorter-CjGwXe5x.js +0 -5
@@ -1,34 +1,628 @@
1
- import { t as Options } from "./index-BNhsnuYk.js";
2
-
1
+ //#region ../../node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/doc.d.ts
2
+ // https://github.com/prettier/prettier/blob/next/src/document/public.js
3
+ declare namespace builders {
4
+ type DocCommand = Align | BreakParent | Cursor | Fill | Group | IfBreak | Indent | IndentIfBreak | Label | Line | LineSuffix | LineSuffixBoundary | Trim;
5
+ type Doc = string | Doc[] | DocCommand;
6
+ interface Align {
7
+ type: "align";
8
+ contents: Doc;
9
+ n: number | string | {
10
+ type: "root";
11
+ };
12
+ }
13
+ interface BreakParent {
14
+ type: "break-parent";
15
+ }
16
+ interface Cursor {
17
+ type: "cursor";
18
+ placeholder: symbol;
19
+ }
20
+ interface Fill {
21
+ type: "fill";
22
+ parts: Doc[];
23
+ }
24
+ interface Group {
25
+ type: "group";
26
+ id?: symbol;
27
+ contents: Doc;
28
+ break: boolean;
29
+ expandedStates: Doc[];
30
+ }
31
+ interface HardlineWithoutBreakParent extends Line {
32
+ hard: true;
33
+ }
34
+ interface IfBreak {
35
+ type: "if-break";
36
+ breakContents: Doc;
37
+ flatContents: Doc;
38
+ }
39
+ interface Indent {
40
+ type: "indent";
41
+ contents: Doc;
42
+ }
43
+ interface IndentIfBreak {
44
+ type: "indent-if-break";
45
+ }
46
+ interface Label {
47
+ type: "label";
48
+ label: any;
49
+ contents: Doc;
50
+ }
51
+ interface Line {
52
+ type: "line";
53
+ soft?: boolean | undefined;
54
+ hard?: boolean | undefined;
55
+ literal?: boolean | undefined;
56
+ }
57
+ interface LineSuffix {
58
+ type: "line-suffix";
59
+ contents: Doc;
60
+ }
61
+ interface LineSuffixBoundary {
62
+ type: "line-suffix-boundary";
63
+ }
64
+ interface LiterallineWithoutBreakParent extends Line {
65
+ hard: true;
66
+ literal: true;
67
+ }
68
+ type LiteralLine = [LiterallineWithoutBreakParent, BreakParent];
69
+ interface Softline extends Line {
70
+ soft: true;
71
+ }
72
+ type Hardline = [HardlineWithoutBreakParent, BreakParent];
73
+ interface Trim {
74
+ type: "trim";
75
+ }
76
+ interface GroupOptions {
77
+ shouldBreak?: boolean | undefined;
78
+ id?: symbol | undefined;
79
+ }
80
+ function addAlignmentToDoc(doc: Doc, size: number, tabWidth: number): Doc;
81
+ /** @see [align](https://github.com/prettier/prettier/blob/main/commands.md#align) */
82
+ function align(widthOrString: Align["n"], doc: Doc): Align;
83
+ /** @see [breakParent](https://github.com/prettier/prettier/blob/main/commands.md#breakparent) */
84
+ const breakParent: BreakParent;
85
+ /** @see [conditionalGroup](https://github.com/prettier/prettier/blob/main/commands.md#conditionalgroup) */
86
+ function conditionalGroup(alternatives: Doc[], options?: GroupOptions): Group;
87
+ /** @see [dedent](https://github.com/prettier/prettier/blob/main/commands.md#dedent) */
88
+ function dedent(doc: Doc): Align;
89
+ /** @see [dedentToRoot](https://github.com/prettier/prettier/blob/main/commands.md#dedenttoroot) */
90
+ function dedentToRoot(doc: Doc): Align;
91
+ /** @see [fill](https://github.com/prettier/prettier/blob/main/commands.md#fill) */
92
+ function fill(docs: Doc[]): Fill;
93
+ /** @see [group](https://github.com/prettier/prettier/blob/main/commands.md#group) */
94
+ function group(doc: Doc, opts?: GroupOptions): Group;
95
+ /** @see [hardline](https://github.com/prettier/prettier/blob/main/commands.md#hardline) */
96
+ const hardline: Hardline;
97
+ /** @see [hardlineWithoutBreakParent](https://github.com/prettier/prettier/blob/main/commands.md#hardlinewithoutbreakparent-and-literallinewithoutbreakparent) */
98
+ const hardlineWithoutBreakParent: HardlineWithoutBreakParent;
99
+ /** @see [ifBreak](https://github.com/prettier/prettier/blob/main/commands.md#ifbreak) */
100
+ function ifBreak(ifBreak: Doc, noBreak?: Doc, options?: {
101
+ groupId?: symbol | undefined;
102
+ }): IfBreak;
103
+ /** @see [indent](https://github.com/prettier/prettier/blob/main/commands.md#indent) */
104
+ function indent(doc: Doc): Indent;
105
+ /** @see [indentIfBreak](https://github.com/prettier/prettier/blob/main/commands.md#indentifbreak) */
106
+ function indentIfBreak(doc: Doc, opts: {
107
+ groupId: symbol;
108
+ negate?: boolean | undefined;
109
+ }): IndentIfBreak;
110
+ /** @see [join](https://github.com/prettier/prettier/blob/main/commands.md#join) */
111
+ function join(sep: Doc, docs: Doc[]): Doc[];
112
+ /** @see [label](https://github.com/prettier/prettier/blob/main/commands.md#label) */
113
+ function label(label: any | undefined, contents: Doc): Doc;
114
+ /** @see [line](https://github.com/prettier/prettier/blob/main/commands.md#line) */
115
+ const line: Line;
116
+ /** @see [lineSuffix](https://github.com/prettier/prettier/blob/main/commands.md#linesuffix) */
117
+ function lineSuffix(suffix: Doc): LineSuffix;
118
+ /** @see [lineSuffixBoundary](https://github.com/prettier/prettier/blob/main/commands.md#linesuffixboundary) */
119
+ const lineSuffixBoundary: LineSuffixBoundary;
120
+ /** @see [literalline](https://github.com/prettier/prettier/blob/main/commands.md#literalline) */
121
+ const literalline: LiteralLine;
122
+ /** @see [literallineWithoutBreakParent](https://github.com/prettier/prettier/blob/main/commands.md#hardlinewithoutbreakparent-and-literallinewithoutbreakparent) */
123
+ const literallineWithoutBreakParent: LiterallineWithoutBreakParent;
124
+ /** @see [markAsRoot](https://github.com/prettier/prettier/blob/main/commands.md#markasroot) */
125
+ function markAsRoot(doc: Doc): Align;
126
+ /** @see [softline](https://github.com/prettier/prettier/blob/main/commands.md#softline) */
127
+ const softline: Softline;
128
+ /** @see [trim](https://github.com/prettier/prettier/blob/main/commands.md#trim) */
129
+ const trim: Trim;
130
+ /** @see [cursor](https://github.com/prettier/prettier/blob/main/commands.md#cursor) */
131
+ const cursor: Cursor;
132
+ }
133
+ declare namespace printer {
134
+ function printDocToString(doc: builders.Doc, options: Options): {
135
+ formatted: string;
136
+ /**
137
+ * This property is a misnomer, and has been since the changes in
138
+ * https://github.com/prettier/prettier/pull/15709.
139
+ * The region of the document indicated by `cursorNodeStart` and `cursorNodeText` will
140
+ * sometimes actually be what lies BETWEEN a pair of leaf nodes in the AST, rather than a node.
141
+ */
142
+ cursorNodeStart?: number | undefined;
143
+ /**
144
+ * Note that, like cursorNodeStart, this is a misnomer and may actually be the text between two
145
+ * leaf nodes in the AST instead of the text of a node.
146
+ */
147
+ cursorNodeText?: string | undefined;
148
+ };
149
+ interface Options {
150
+ /**
151
+ * Specify the line length that the printer will wrap on.
152
+ * @default 80
153
+ */
154
+ printWidth: number;
155
+ /**
156
+ * Specify the number of spaces per indentation-level.
157
+ * @default 2
158
+ */
159
+ tabWidth: number;
160
+ /**
161
+ * Indent lines with tabs instead of spaces
162
+ * @default false
163
+ */
164
+ useTabs?: boolean;
165
+ parentParser?: string | undefined;
166
+ __embeddedInHtml?: boolean | undefined;
167
+ }
168
+ }
169
+ declare namespace utils {
170
+ function willBreak(doc: builders.Doc): boolean;
171
+ function traverseDoc(doc: builders.Doc, onEnter?: (doc: builders.Doc) => void | boolean, onExit?: (doc: builders.Doc) => void, shouldTraverseConditionalGroups?: boolean): void;
172
+ function findInDoc<T = builders.Doc>(doc: builders.Doc, callback: (doc: builders.Doc) => T, defaultValue: T): T;
173
+ function mapDoc<T = builders.Doc>(doc: builders.Doc, callback: (doc: builders.Doc) => T): T;
174
+ function removeLines(doc: builders.Doc): builders.Doc;
175
+ function stripTrailingHardline(doc: builders.Doc): builders.Doc;
176
+ function replaceEndOfLine(doc: builders.Doc, replacement?: builders.Doc): builders.Doc;
177
+ function canBreak(doc: builders.Doc): boolean;
178
+ }
179
+ //#endregion
180
+ //#region ../../node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/index.d.ts
181
+ declare namespace doc {
182
+ export { builders, printer, utils };
183
+ }
184
+ // This utility is here to handle the case where you have an explicit union
185
+ // between string literals and the generic string type. It would normally
186
+ // resolve out to just the string type, but this generic LiteralUnion maintains
187
+ // the intellisense of the original union.
188
+ //
189
+ // It comes from this issue: microsoft/TypeScript#29729:
190
+ // https://github.com/microsoft/TypeScript/issues/29729#issuecomment-700527227
191
+ type LiteralUnion<T extends U, U = string> = T | (Pick<U, never> & {
192
+ _?: never | undefined;
193
+ });
194
+ type Doc$1 = doc.builders.Doc;
195
+ // The type of elements that make up the given array T.
196
+ type ArrayElement<T> = T extends Array<infer E> ? E : never; // A union of the properties of the given object that are arrays.
197
+ type ArrayProperties<T> = { [K in keyof T]: NonNullable<T[K]> extends readonly any[] ? K : never }[keyof T]; // A union of the properties of the given array T that can be used to index it.
198
+ // If the array is a tuple, then that's going to be the explicit indices of the
199
+ // array, otherwise it's going to just be number.
200
+ type IndexProperties<T extends {
201
+ length: number;
202
+ }> = IsTuple<T> extends true ? Exclude<Partial<T>["length"], T["length"]> : number; // Effectively performing T[P], except that it's telling TypeScript that it's
203
+ // safe to do this for tuples, arrays, or objects.
204
+ type IndexValue<T, P> = T extends any[] ? P extends number ? T[P] : never : P extends keyof T ? T[P] : never; // Determines if an object T is an array like string[] (in which case this
205
+ // evaluates to false) or a tuple like [string] (in which case this evaluates to
206
+ // true).
207
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
208
+ type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false;
209
+ type CallProperties<T> = T extends any[] ? IndexProperties<T> : keyof T;
210
+ type IterProperties<T> = T extends any[] ? IndexProperties<T> : ArrayProperties<T>;
211
+ type CallCallback<T, U> = (path: AstPath<T>, index: number, value: any) => U;
212
+ type EachCallback<T> = (path: AstPath<ArrayElement<T>>, index: number, value: any) => void;
213
+ type MapCallback<T, U> = (path: AstPath<ArrayElement<T>>, index: number, value: any) => U; // https://github.com/prettier/prettier/blob/next/src/common/ast-path.js
214
+ declare class AstPath<T = any> {
215
+ constructor(value: T);
216
+ get key(): string | null;
217
+ get index(): number | null;
218
+ get node(): T;
219
+ get parent(): T | null;
220
+ get grandparent(): T | null;
221
+ get isInArray(): boolean;
222
+ get siblings(): T[] | null;
223
+ get next(): T | null;
224
+ get previous(): T | null;
225
+ get isFirst(): boolean;
226
+ get isLast(): boolean;
227
+ get isRoot(): boolean;
228
+ get root(): T;
229
+ get ancestors(): T[];
230
+ stack: T[];
231
+ callParent<U>(callback: (path: this) => U, count?: number): U;
232
+ /**
233
+ * @deprecated Please use `AstPath#key` or `AstPath#index`
234
+ */
235
+ getName(): PropertyKey | null;
236
+ /**
237
+ * @deprecated Please use `AstPath#node` or `AstPath#siblings`
238
+ */
239
+ getValue(): T;
240
+ getNode(count?: number): T | null;
241
+ getParentNode(count?: number): T | null;
242
+ match(...predicates: Array<(node: any, name: string | null, number: number | null) => boolean>): boolean; // For each of the tree walk functions (call, each, and map) this provides 5
243
+ // strict type signatures, along with a fallback at the end if you end up
244
+ // calling more than 5 properties deep. This helps a lot with typing because
245
+ // for the majority of cases you're calling fewer than 5 properties, so the
246
+ // tree walk functions have a clearer understanding of what you're doing.
247
+ //
248
+ // Note that resolving these types is somewhat complicated, and it wasn't
249
+ // even supported until TypeScript 4.2 (before it would just say that the
250
+ // type instantiation was excessively deep and possibly infinite).
251
+ call<U>(callback: CallCallback<T, U>): U;
252
+ call<U, P1 extends CallProperties<T>>(callback: CallCallback<IndexValue<T, P1>, U>, prop1: P1): U;
253
+ call<U, P1 extends keyof T, P2 extends CallProperties<T[P1]>>(callback: CallCallback<IndexValue<IndexValue<T, P1>, P2>, U>, prop1: P1, prop2: P2): U;
254
+ call<U, P1 extends keyof T, P2 extends CallProperties<T[P1]>, P3 extends CallProperties<IndexValue<T[P1], P2>>>(callback: CallCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, U>, prop1: P1, prop2: P2, prop3: P3): U;
255
+ call<U, P1 extends keyof T, P2 extends CallProperties<T[P1]>, P3 extends CallProperties<IndexValue<T[P1], P2>>, P4 extends CallProperties<IndexValue<IndexValue<T[P1], P2>, P3>>>(callback: CallCallback<IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>, U>, prop1: P1, prop2: P2, prop3: P3, prop4: P4): U;
256
+ call<U, P extends PropertyKey>(callback: CallCallback<any, U>, prop1: P, prop2: P, prop3: P, prop4: P, ...props: P[]): U;
257
+ each(callback: EachCallback<T>): void;
258
+ each<P1 extends IterProperties<T>>(callback: EachCallback<IndexValue<T, P1>>, prop1: P1): void;
259
+ each<P1 extends keyof T, P2 extends IterProperties<T[P1]>>(callback: EachCallback<IndexValue<IndexValue<T, P1>, P2>>, prop1: P1, prop2: P2): void;
260
+ each<P1 extends keyof T, P2 extends IterProperties<T[P1]>, P3 extends IterProperties<IndexValue<T[P1], P2>>>(callback: EachCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>>, prop1: P1, prop2: P2, prop3: P3): void;
261
+ each<P1 extends keyof T, P2 extends IterProperties<T[P1]>, P3 extends IterProperties<IndexValue<T[P1], P2>>, P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>>>(callback: EachCallback<IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>>, prop1: P1, prop2: P2, prop3: P3, prop4: P4): void;
262
+ each(callback: EachCallback<any[]>, prop1: PropertyKey, prop2: PropertyKey, prop3: PropertyKey, prop4: PropertyKey, ...props: PropertyKey[]): void;
263
+ map<U>(callback: MapCallback<T, U>): U[];
264
+ map<U, P1 extends IterProperties<T>>(callback: MapCallback<IndexValue<T, P1>, U>, prop1: P1): U[];
265
+ map<U, P1 extends keyof T, P2 extends IterProperties<T[P1]>>(callback: MapCallback<IndexValue<IndexValue<T, P1>, P2>, U>, prop1: P1, prop2: P2): U[];
266
+ map<U, P1 extends keyof T, P2 extends IterProperties<T[P1]>, P3 extends IterProperties<IndexValue<T[P1], P2>>>(callback: MapCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, U>, prop1: P1, prop2: P2, prop3: P3): U[];
267
+ map<U, P1 extends keyof T, P2 extends IterProperties<T[P1]>, P3 extends IterProperties<IndexValue<T[P1], P2>>, P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>>>(callback: MapCallback<IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>, U>, prop1: P1, prop2: P2, prop3: P3, prop4: P4): U[];
268
+ map<U>(callback: MapCallback<any[], U>, prop1: PropertyKey, prop2: PropertyKey, prop3: PropertyKey, prop4: PropertyKey, ...props: PropertyKey[]): U[];
269
+ }
270
+ type BuiltInParserName = "acorn" | "angular" | "babel-flow" | "babel-ts" | "babel" | "css" | "espree" | "flow" | "glimmer" | "graphql" | "html" | "json-stringify" | "json" | "json5" | "jsonc" | "less" | "lwc" | "markdown" | "mdx" | "meriyah" | "mjml" | "scss" | "typescript" | "vue" | "yaml";
271
+ interface Options$1 extends Partial<RequiredOptions> {}
272
+ interface RequiredOptions extends doc.printer.Options {
273
+ /**
274
+ * Print semicolons at the ends of statements.
275
+ * @default true
276
+ */
277
+ semi: boolean;
278
+ /**
279
+ * Use single quotes instead of double quotes.
280
+ * @default false
281
+ */
282
+ singleQuote: boolean;
283
+ /**
284
+ * Use single quotes in JSX.
285
+ * @default false
286
+ */
287
+ jsxSingleQuote: boolean;
288
+ /**
289
+ * Print trailing commas wherever possible.
290
+ * @default "all"
291
+ */
292
+ trailingComma: "none" | "es5" | "all";
293
+ /**
294
+ * Print spaces between brackets in object literals.
295
+ * @default true
296
+ */
297
+ bracketSpacing: boolean;
298
+ /**
299
+ * How to wrap object literals.
300
+ * @default "preserve"
301
+ */
302
+ objectWrap: "preserve" | "collapse";
303
+ /**
304
+ * Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
305
+ * alone on the next line (does not apply to self closing elements).
306
+ * @default false
307
+ */
308
+ bracketSameLine: boolean;
309
+ /**
310
+ * Format only a segment of a file.
311
+ * @default 0
312
+ */
313
+ rangeStart: number;
314
+ /**
315
+ * Format only a segment of a file.
316
+ * @default Number.POSITIVE_INFINITY
317
+ */
318
+ rangeEnd: number;
319
+ /**
320
+ * Specify which parser to use.
321
+ */
322
+ parser: LiteralUnion<BuiltInParserName>;
323
+ /**
324
+ * Specify the input filepath. This will be used to do parser inference.
325
+ */
326
+ filepath: string;
327
+ /**
328
+ * Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
329
+ * This is very useful when gradually transitioning large, unformatted codebases to prettier.
330
+ * @default false
331
+ */
332
+ requirePragma: boolean;
333
+ /**
334
+ * Prettier can insert a special @format marker at the top of files specifying that
335
+ * the file has been formatted with prettier. This works well when used in tandem with
336
+ * the --require-pragma option. If there is already a docblock at the top of
337
+ * the file then this option will add a newline to it with the @format marker.
338
+ * @default false
339
+ */
340
+ insertPragma: boolean;
341
+ /**
342
+ * Prettier can allow individual files to opt out of formatting if they contain a special comment, called a pragma, at the top of the file.
343
+ * @default false
344
+ */
345
+ checkIgnorePragma: boolean;
346
+ /**
347
+ * By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
348
+ * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
349
+ * @default "preserve"
350
+ */
351
+ proseWrap: "always" | "never" | "preserve";
352
+ /**
353
+ * Include parentheses around a sole arrow function parameter.
354
+ * @default "always"
355
+ */
356
+ arrowParens: "avoid" | "always";
357
+ /**
358
+ * Provide ability to support new languages to prettier.
359
+ */
360
+ plugins: Array<string | URL | Plugin>;
361
+ /**
362
+ * How to handle whitespaces in HTML.
363
+ * @default "css"
364
+ */
365
+ htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
366
+ /**
367
+ * Which end of line characters to apply.
368
+ * @default "lf"
369
+ */
370
+ endOfLine: "auto" | "lf" | "crlf" | "cr";
371
+ /**
372
+ * Change when properties in objects are quoted.
373
+ * @default "as-needed"
374
+ */
375
+ quoteProps: "as-needed" | "consistent" | "preserve";
376
+ /**
377
+ * Whether or not to indent the code inside <script> and <style> tags in Vue files.
378
+ * @default false
379
+ */
380
+ vueIndentScriptAndStyle: boolean;
381
+ /**
382
+ * Control whether Prettier formats quoted code embedded in the file.
383
+ * @default "auto"
384
+ */
385
+ embeddedLanguageFormatting: "auto" | "off";
386
+ /**
387
+ * Enforce single attribute per line in HTML, Vue and JSX.
388
+ * @default false
389
+ */
390
+ singleAttributePerLine: boolean;
391
+ /**
392
+ * Where to print operators when binary expressions wrap lines.
393
+ * @default "end"
394
+ */
395
+ experimentalOperatorPosition: "start" | "end";
396
+ /**
397
+ * Use curious ternaries, with the question mark after the condition, instead
398
+ * of on the same line as the consequent.
399
+ * @default false
400
+ */
401
+ experimentalTernaries: boolean;
402
+ /**
403
+ * Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
404
+ * @default false
405
+ * @deprecated use bracketSameLine instead
406
+ */
407
+ jsxBracketSameLine?: boolean;
408
+ /**
409
+ * Arbitrary additional values on an options object are always allowed.
410
+ */
411
+ [_: string]: unknown;
412
+ }
413
+ interface ParserOptions<T = any> extends RequiredOptions {
414
+ locStart: (node: T) => number;
415
+ locEnd: (node: T) => number;
416
+ originalText: string;
417
+ }
418
+ interface Plugin<T = any> {
419
+ languages?: SupportLanguage[] | undefined;
420
+ parsers?: {
421
+ [parserName: string]: Parser<T>;
422
+ } | undefined;
423
+ printers?: {
424
+ [astFormat: string]: Printer<T>;
425
+ } | undefined;
426
+ options?: SupportOptions | undefined;
427
+ defaultOptions?: Partial<RequiredOptions> | undefined;
428
+ }
429
+ interface Parser<T = any> {
430
+ parse: (text: string, options: ParserOptions<T>) => T | Promise<T>;
431
+ astFormat: string;
432
+ hasPragma?: ((text: string) => boolean) | undefined;
433
+ hasIgnorePragma?: ((text: string) => boolean) | undefined;
434
+ locStart: (node: T) => number;
435
+ locEnd: (node: T) => number;
436
+ preprocess?: ((text: string, options: ParserOptions<T>) => string | Promise<string>) | undefined;
437
+ }
438
+ interface Printer<T = any> {
439
+ print(path: AstPath<T>, options: ParserOptions<T>, print: (path: AstPath<T>) => Doc$1, args?: unknown): Doc$1;
440
+ printPrettierIgnored?(path: AstPath<T>, options: ParserOptions<T>, print: (path: AstPath<T>) => Doc$1, args?: unknown): Doc$1;
441
+ embed?: ((path: AstPath, options: Options$1) => ((textToDoc: (text: string, options: Options$1) => Promise<Doc$1>, print: (selector?: string | number | Array<string | number> | AstPath) => Doc$1, path: AstPath, options: Options$1) => Promise<Doc$1 | undefined> | Doc$1 | undefined) | Doc$1 | null) | undefined;
442
+ preprocess?: ((ast: T, options: ParserOptions<T>) => T | Promise<T>) | undefined;
443
+ insertPragma?: (text: string) => string;
444
+ /**
445
+ * @returns `null` if you want to remove this node
446
+ * @returns `void` if you want to use modified `cloned`
447
+ * @returns anything if you want to replace the node with it
448
+ */
449
+ massageAstNode?: ((original: any, cloned: any, parent: any) => any) | undefined;
450
+ hasPrettierIgnore?: ((path: AstPath<T>) => boolean) | undefined;
451
+ canAttachComment?: ((node: T, ancestors: T[]) => boolean) | undefined;
452
+ isBlockComment?: ((node: T) => boolean) | undefined;
453
+ willPrintOwnComments?: ((path: AstPath<T>) => boolean) | undefined;
454
+ printComment?: ((commentPath: AstPath<T>, options: ParserOptions<T>) => Doc$1) | undefined;
455
+ /**
456
+ * By default, Prettier searches all object properties (except for a few predefined ones) of each node recursively.
457
+ * This function can be provided to override that behavior.
458
+ * @param node The node whose children should be returned.
459
+ * @param options Current options.
460
+ * @returns `[]` if the node has no children or `undefined` to fall back on the default behavior.
461
+ */
462
+ getCommentChildNodes?: ((node: T, options: ParserOptions<T>) => T[] | undefined) | undefined;
463
+ handleComments?: {
464
+ ownLine?: ((commentNode: any, text: string, options: ParserOptions<T>, ast: T, isLastComment: boolean) => boolean) | undefined;
465
+ endOfLine?: ((commentNode: any, text: string, options: ParserOptions<T>, ast: T, isLastComment: boolean) => boolean) | undefined;
466
+ remaining?: ((commentNode: any, text: string, options: ParserOptions<T>, ast: T, isLastComment: boolean) => boolean) | undefined;
467
+ } | undefined;
468
+ getVisitorKeys?: ((node: T, nonTraversableKeys: Set<string>) => string[]) | undefined;
469
+ }
470
+ interface SupportLanguage {
471
+ name: string;
472
+ parsers: BuiltInParserName[] | string[];
473
+ group?: string | undefined;
474
+ tmScope?: string | undefined;
475
+ aceMode?: string | undefined;
476
+ codemirrorMode?: string | undefined;
477
+ codemirrorMimeType?: string | undefined;
478
+ aliases?: string[] | undefined;
479
+ extensions?: string[] | undefined;
480
+ filenames?: string[] | undefined;
481
+ linguistLanguageId?: number | undefined;
482
+ vscodeLanguageIds?: string[] | undefined;
483
+ interpreters?: string[] | undefined;
484
+ isSupported?: ((options: {
485
+ filepath: string;
486
+ }) => boolean) | undefined;
487
+ }
488
+ interface SupportOptionRange {
489
+ start: number;
490
+ end: number;
491
+ step: number;
492
+ }
493
+ type SupportOptionType = "int" | "string" | "boolean" | "choice" | "path";
494
+ interface BaseSupportOption<Type extends SupportOptionType> {
495
+ readonly name?: string | undefined;
496
+ /**
497
+ * Usually you can use {@link CoreCategoryType}
498
+ */
499
+ category: string;
500
+ /**
501
+ * The type of the option.
502
+ *
503
+ * When passing a type other than the ones listed below, the option is
504
+ * treated as taking any string as argument, and `--option <${type}>` will
505
+ * be displayed in --help.
506
+ */
507
+ type: Type;
508
+ /**
509
+ * Indicate that the option is deprecated.
510
+ *
511
+ * Use a string to add an extra message to --help for the option,
512
+ * for example to suggest a replacement option.
513
+ */
514
+ deprecated?: true | string | undefined;
515
+ /**
516
+ * Description to be displayed in --help. If omitted, the option won't be
517
+ * shown at all in --help.
518
+ */
519
+ description?: string | undefined;
520
+ }
521
+ interface IntSupportOption extends BaseSupportOption<"int"> {
522
+ default?: number | undefined;
523
+ array?: false | undefined;
524
+ range?: SupportOptionRange | undefined;
525
+ }
526
+ interface IntArraySupportOption extends BaseSupportOption<"int"> {
527
+ default?: Array<{
528
+ value: number[];
529
+ }> | undefined;
530
+ array: true;
531
+ }
532
+ interface StringSupportOption extends BaseSupportOption<"string"> {
533
+ default?: string | undefined;
534
+ array?: false | undefined;
535
+ }
536
+ interface StringArraySupportOption extends BaseSupportOption<"string"> {
537
+ default?: Array<{
538
+ value: string[];
539
+ }> | undefined;
540
+ array: true;
541
+ }
542
+ interface BooleanSupportOption extends BaseSupportOption<"boolean"> {
543
+ default?: boolean | undefined;
544
+ array?: false | undefined;
545
+ description: string;
546
+ oppositeDescription?: string | undefined;
547
+ }
548
+ interface BooleanArraySupportOption extends BaseSupportOption<"boolean"> {
549
+ default?: Array<{
550
+ value: boolean[];
551
+ }> | undefined;
552
+ array: true;
553
+ }
554
+ interface ChoiceSupportOption<Value = any> extends BaseSupportOption<"choice"> {
555
+ default?: Value | Array<{
556
+ value: Value;
557
+ }> | undefined;
558
+ description: string;
559
+ choices: Array<{
560
+ value: Value;
561
+ description: string;
562
+ }>;
563
+ }
564
+ interface PathSupportOption extends BaseSupportOption<"path"> {
565
+ default?: string | undefined;
566
+ array?: false | undefined;
567
+ }
568
+ interface PathArraySupportOption extends BaseSupportOption<"path"> {
569
+ default?: Array<{
570
+ value: string[];
571
+ }> | undefined;
572
+ array: true;
573
+ }
574
+ type SupportOption = IntSupportOption | IntArraySupportOption | StringSupportOption | StringArraySupportOption | BooleanSupportOption | BooleanArraySupportOption | ChoiceSupportOption | PathSupportOption | PathArraySupportOption;
575
+ interface SupportOptions extends Record<string, SupportOption> {}
576
+ //#endregion
3
577
  //#region src-js/libs/apis.d.ts
578
+ type FormatFileParam = {
579
+ code: string;
580
+ options: Options$1;
581
+ };
582
+ /**
583
+ * Format non-js file
584
+ *
585
+ * @returns Formatted code
586
+ */
587
+ declare function formatFile({
588
+ code,
589
+ options
590
+ }: FormatFileParam): Promise<string>;
4
591
  type FormatEmbeddedCodeParam = {
5
592
  code: string;
6
- options: Options;
593
+ options: Options$1;
7
594
  };
8
595
  /**
9
- * Format xxx-in-js code snippets
596
+ * Format xxx-in-js code snippets into formatted string.
597
+ *
598
+ * This will be gradually replaced by `formatEmbeddedDoc` which returns `Doc`.
599
+ * For now, html|css|md-in-js are using this.
10
600
  *
11
601
  * @returns Formatted code snippet
12
- * TODO: In the future, this should return `Doc` instead of string,
13
- * otherwise, we cannot calculate `printWidth` correctly.
14
602
  */
15
603
  declare function formatEmbeddedCode({
16
604
  code,
17
605
  options
18
606
  }: FormatEmbeddedCodeParam): Promise<string>;
19
- type FormatFileParam = {
20
- code: string;
21
- options: Options;
607
+ type FormatEmbeddedDocParam = {
608
+ texts: string[];
609
+ options: Options$1;
22
610
  };
23
611
  /**
24
- * Format non-js file
612
+ * Format xxx-in-js code snippets into Prettier `Doc` JSON strings.
25
613
  *
26
- * @returns Formatted code
614
+ * This makes `oxc_formatter` correctly handle `printWidth` even for embedded code.
615
+ * - For gql-in-js, `texts` contains multiple parts split by `${}` in a template literal
616
+ * - For others, `texts` always contains a single string with `${}` parts replaced by placeholders
617
+ * However, this function does not need to be aware of that,
618
+ * as it simply formats each text part independently and returns an array of formatted parts.
619
+ *
620
+ * @returns Doc JSON strings (one per input text)
27
621
  */
28
- declare function formatFile({
29
- code,
622
+ declare function formatEmbeddedDoc({
623
+ texts,
30
624
  options
31
- }: FormatFileParam): Promise<string>;
625
+ }: FormatEmbeddedDocParam): Promise<string[]>;
32
626
  interface SortTailwindClassesArgs {
33
627
  classes: string[];
34
628
  options: {
@@ -49,4 +643,4 @@ declare function sortTailwindClasses({
49
643
  options
50
644
  }: SortTailwindClassesArgs): Promise<string[]>;
51
645
  //#endregion
52
- export { formatEmbeddedCode, formatFile, sortTailwindClasses };
646
+ export { formatEmbeddedCode, formatEmbeddedDoc, formatFile, sortTailwindClasses };
@@ -1,3 +1,2 @@
1
- import { i as sortTailwindClasses, n as formatFile, t as formatEmbeddedCode } from "./apis-KSwODFyo.js";
2
-
3
- export { formatEmbeddedCode, formatFile, sortTailwindClasses };
1
+ import { a as sortTailwindClasses, n as formatEmbeddedDoc, r as formatFile, t as formatEmbeddedCode } from "./apis-BoXLniqX.js";
2
+ export { formatEmbeddedCode, formatEmbeddedDoc, formatFile, sortTailwindClasses };