oxfmt 0.36.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 (41) hide show
  1. package/dist/{acorn-DSYDYt2u.js → acorn-BnWlLI9w.js} +1 -2
  2. package/dist/{angular-BYaMjeNY.js → angular-BjdVY6ry.js} +3 -5
  3. package/dist/{apis-C04w0rkO.js → apis-BoXLniqX.js} +5 -6
  4. package/dist/babel-cHKEVC-N.js +2 -0
  5. package/dist/{bindings-BY08Skk2.js → bindings-Cpav0PNl.js} +27 -29
  6. package/dist/{chunk-DSjvVL_1-B9nK_dIv.js → chunk-DSjvVL_1-BYdvZw3N.js} +1 -3
  7. package/dist/chunk-DrSxFLj_.js +14 -0
  8. package/dist/cli-worker.d.ts +579 -5
  9. package/dist/cli-worker.js +2 -3
  10. package/dist/cli.js +6 -9
  11. package/dist/{dist-BIcAktiQ.js → dist-BxX-OKHo.js} +14 -18
  12. package/dist/{estree-DBPlpXot.js → estree-BdH1ynKb.js} +1 -2
  13. package/dist/{flow-DZRswbuH.js → flow-JTvJzd2b.js} +1 -2
  14. package/dist/{glimmer-B28TNYIB.js → glimmer-Dj-rhc3H.js} +1 -2
  15. package/dist/{graphql-3p9xuuKy.js → graphql-C66DjsEv.js} +1 -2
  16. package/dist/{html-D2VbMQAT.js → html-cr_GTtzg.js} +1 -2
  17. package/dist/index.d.ts +425 -70
  18. package/dist/index.js +3 -5
  19. package/dist/{init-BlnymtNS.js → init-BbKOMZ57.js} +2 -4
  20. package/dist/{jiti-Bb1dT6Cw-D7Kk0pkW.js → jiti-Bb1dT6Cw-BzC3jhZX.js} +2 -4
  21. package/dist/{markdown-DdJpriJP.js → markdown-4I9EsAQD.js} +1 -2
  22. package/dist/{meriyah-CQnZTN4N.js → meriyah-Dyll-d_f.js} +1 -2
  23. package/dist/{migrate-biome-B4fq26fI.js → migrate-biome-BMqs7-eg.js} +2 -4
  24. package/dist/{migrate-prettier-BrvLf3WK.js → migrate-prettier-BfVrZTrL.js} +3 -5
  25. package/dist/{postcss-o-3qwTQO.js → postcss-Cy4xGDrs.js} +2 -3
  26. package/dist/{prettier-CK6Vmyxp.js → prettier-DYJRSbN0.js} +16 -19
  27. package/dist/{prettier-plugin-oxfmt-DQXypUIM.js → prettier-plugin-oxfmt-DGn95w-c.js} +3 -6
  28. package/dist/{resolve-pWjAK-4f-DMrPXOR5.js → resolve-pWjAK-4f-C1Z6M6r2.js} +2 -4
  29. package/dist/{shared-BhroZgjV.js → shared-BTEY2VsW.js} +1 -3
  30. package/dist/{sorter-BZkvDMjt-CZzzihz1.js → sorter-BZkvDMjt-n6dGttqp.js} +6 -8
  31. package/dist/sorter-D7zO39b5.js +3 -0
  32. package/dist/{typescript-D5lCjM2U.js → typescript-8enly1_u.js} +1 -2
  33. package/dist/{utils-D8dQkKEd-w107AldM.js → utils-D8dQkKEd-BtAa7w-M.js} +1 -3
  34. package/dist/{v3-D-mr2VVh-Bj3_v5Qp.js → v3-D-mr2VVh-FqDpKDIq.js} +4 -6
  35. package/dist/{v4-C-HWEQJm-D29N-mp3.js → v4-C-HWEQJm-DL_vfdDs.js} +4 -6
  36. package/dist/{yaml-jtj0ZWQC.js → yaml-B6CM-Uf_.js} +1 -2
  37. package/package.json +20 -20
  38. package/dist/babel-CsJ8KocL.js +0 -3
  39. package/dist/chunk-DpReBE2K.js +0 -20
  40. package/dist/index-BNhsnuYk.d.ts +0 -577
  41. package/dist/sorter-DmFkUshw.js +0 -5
@@ -1,13 +1,12 @@
1
- import { t as __exportAll } from "./chunk-DpReBE2K.js";
2
- import { a as __toESM, t as __commonJSMin } from "./chunk-DSjvVL_1-B9nK_dIv.js";
3
- import { n as loadIfExists, r as maybeResolve, t as expiringMap } from "./resolve-pWjAK-4f-DMrPXOR5.js";
4
- import { i as visit, n as cacheForDirs, r as spliceChangesIntoString } from "./utils-D8dQkKEd-w107AldM.js";
5
- import { a as sortClasses, i as sortClassList, n as error, o as warn, r as getTailwindConfig$1 } from "./sorter-BZkvDMjt-CZzzihz1.js";
6
- import { a as en$1, o as postcss_exports } from "./angular-BYaMjeNY.js";
7
- import { t as index_exports } from "./prettier-CK6Vmyxp.js";
1
+ import { t as __exportAll } from "./chunk-DrSxFLj_.js";
2
+ import { a as __toESM, t as __commonJSMin } from "./chunk-DSjvVL_1-BYdvZw3N.js";
3
+ import { n as loadIfExists, r as maybeResolve, t as expiringMap } from "./resolve-pWjAK-4f-C1Z6M6r2.js";
4
+ import { i as visit, n as cacheForDirs, r as spliceChangesIntoString } from "./utils-D8dQkKEd-BtAa7w-M.js";
5
+ import { a as sortClasses, i as sortClassList, n as error, o as warn, r as getTailwindConfig$1 } from "./sorter-BZkvDMjt-n6dGttqp.js";
6
+ import { a as en$1, o as postcss_exports } from "./angular-BjdVY6ry.js";
7
+ import { t as index_exports } from "./prettier-DYJRSbN0.js";
8
8
  import * as path from "node:path";
9
9
  import { isAbsolute } from "path";
10
-
11
10
  //#region ../../node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/plugins/angular.mjs
12
11
  var Ci$1 = Object.defineProperty;
13
12
  var _i$1 = Object.getPrototypeOf;
@@ -3957,7 +3956,6 @@ function tt$1(t) {
3957
3956
  };
3958
3957
  }
3959
3958
  var Fr$1 = tt$1(et$1), Vr$1 = tt$1(Zt$1), Ur$1 = tt$1(en), Hr$1 = tt$1(tn);
3960
-
3961
3959
  //#endregion
3962
3960
  //#region ../../node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/plugins/babel.mjs
3963
3961
  var babel_exports = /* @__PURE__ */ __exportAll({
@@ -13839,7 +13837,6 @@ var ra = {
13839
13837
  ...kt,
13840
13838
  ...Lt
13841
13839
  };
13842
-
13843
13840
  //#endregion
13844
13841
  //#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.3997fbd_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs
13845
13842
  var require_isarray = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -14880,7 +14877,7 @@ const { parsers, printers } = createPlugin([
14880
14877
  staticAttrs: ["class"],
14881
14878
  load: [{
14882
14879
  name: "prettier/plugins/html",
14883
- importer: () => import("./html-D2VbMQAT.js")
14880
+ importer: () => import("./html-cr_GTtzg.js")
14884
14881
  }],
14885
14882
  compatible: ["prettier-plugin-organize-attributes"],
14886
14883
  parsers: {
@@ -14895,7 +14892,7 @@ const { parsers, printers } = createPlugin([
14895
14892
  staticAttrs: ["class"],
14896
14893
  load: [{
14897
14894
  name: "prettier/plugins/glimmer",
14898
- importer: () => import("./glimmer-B28TNYIB.js")
14895
+ importer: () => import("./glimmer-Dj-rhc3H.js")
14899
14896
  }],
14900
14897
  parsers: { glimmer: {} },
14901
14898
  transform: transformGlimmer
@@ -14927,19 +14924,19 @@ const { parsers, printers } = createPlugin([
14927
14924
  __js_expression: { load: [babel_exports] },
14928
14925
  typescript: { load: [{
14929
14926
  name: "prettier/plugins/typescript",
14930
- importer: () => import("./typescript-D5lCjM2U.js")
14927
+ importer: () => import("./typescript-8enly1_u.js")
14931
14928
  }] },
14932
14929
  meriyah: { load: [{
14933
14930
  name: "prettier/plugins/meriyah",
14934
- importer: () => import("./meriyah-CQnZTN4N.js")
14931
+ importer: () => import("./meriyah-Dyll-d_f.js")
14935
14932
  }] },
14936
14933
  acorn: { load: [{
14937
14934
  name: "prettier/plugins/acorn",
14938
- importer: () => import("./acorn-DSYDYt2u.js")
14935
+ importer: () => import("./acorn-BnWlLI9w.js")
14939
14936
  }] },
14940
14937
  flow: { load: [{
14941
14938
  name: "prettier/plugins/flow",
14942
- importer: () => import("./flow-DZRswbuH.js")
14939
+ importer: () => import("./flow-JTvJzd2b.js")
14943
14940
  }] },
14944
14941
  oxc: { load: [{
14945
14942
  name: "@prettier/plugin-oxc",
@@ -15039,6 +15036,5 @@ const { parsers, printers } = createPlugin([
15039
15036
  transform: transformLiquid
15040
15037
  })
15041
15038
  ]);
15042
-
15043
15039
  //#endregion
15044
- export { sn as i, ra as n, options, parsers, printers, Ei$1 as r, Ks as t };
15040
+ export { sn as i, ra as n, options, parsers, printers, Ei$1 as r, Ks as t };
@@ -7262,6 +7262,5 @@ var dD = {
7262
7262
  estree: Hs,
7263
7263
  "estree-json": Xs
7264
7264
  }, CD = [...Qs, ...ya];
7265
-
7266
7265
  //#endregion
7267
- export { Ta as default, CD as languages, Aa as options, dD as printers };
7266
+ export { Ta as default, CD as languages, Aa as options, dD as printers };
@@ -52908,6 +52908,5 @@ function FI0(a0) {
52908
52908
  });
52909
52909
  }
52910
52910
  var MI0 = gz(FI0);
52911
-
52912
52911
  //#endregion
52913
- export { Tz as default, tD as parsers };
52912
+ export { Tz as default, tD as parsers };
@@ -7537,6 +7537,5 @@ var Ni = {
7537
7537
  locEnd: Gt
7538
7538
  };
7539
7539
  var Ai = { glimmer: _n };
7540
-
7541
7540
  //#endregion
7542
- export { Bn as default, Ln as languages, yr as parsers, Ai as printers };
7541
+ export { Bn as default, Ln as languages, yr as parsers, Ai as printers };
@@ -1937,6 +1937,5 @@ var tn = {
1937
1937
  locEnd: q
1938
1938
  };
1939
1939
  var nn = { graphql: Ge };
1940
-
1941
1940
  //#endregion
1942
- export { ut as default, Ye as languages, $e as options, he as parsers, nn as printers };
1941
+ export { ut as default, Ye as languages, $e as options, he as parsers, nn as printers };
@@ -7031,6 +7031,5 @@ var wl = gt(rr), kl = new Set(["mj-style", "mj-raw"]), xl = gt({
7031
7031
  canSelfClose: !1
7032
7032
  });
7033
7033
  var Ll = { html: hs };
7034
-
7035
7034
  //#endregion
7036
- export { ws as default, ms as languages, ds as options, Qr as parsers, Ll as printers };
7035
+ export { ws as default, ms as languages, ds as options, Qr as parsers, Ll as printers };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { t as Options } from "./index-BNhsnuYk.js";
2
-
3
1
  //#region src-js/bindings.d.ts
4
2
  interface ErrorLabel {
5
3
  message: string | null;
@@ -25,83 +23,440 @@ interface FormatResult {
25
23
  errors: Array<OxcError>;
26
24
  }
27
25
  //#endregion
28
- //#region src-js/index.d.ts
29
- /**
30
- * Format the given source text according to the specified options.
31
- */
32
- declare function format(fileName: string, sourceText: string, options?: FormatOptions): Promise<FormatResult>;
26
+ //#region src-js/config.generated.d.ts
27
+ type ArrowParensConfig = "always" | "avoid";
28
+ type EmbeddedLanguageFormattingConfig = "auto" | "off";
29
+ type EndOfLineConfig = "lf" | "crlf" | "cr";
30
+ type HtmlWhitespaceSensitivityConfig = "css" | "strict" | "ignore";
31
+ type ObjectWrapConfig = "preserve" | "collapse";
32
+ type ProseWrapConfig = "always" | "never" | "preserve";
33
+ type QuotePropsConfig = "as-needed" | "consistent" | "preserve";
34
+ type SortGroupItemConfig = NewlinesBetweenMarker | string | string[];
35
+ type SortOrderConfig = "asc" | "desc";
36
+ type SortPackageJsonUserConfig = boolean | SortPackageJsonConfig;
37
+ type TrailingCommaConfig = "all" | "es5" | "none";
38
+ interface FormatConfig {
39
+ /**
40
+ * Include parentheses around a sole arrow function parameter.
41
+ *
42
+ * - Default: `"always"`
43
+ */
44
+ arrowParens?: ArrowParensConfig | null;
45
+ /**
46
+ * Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line,
47
+ * instead of being alone on the next line (does not apply to self closing elements).
48
+ *
49
+ * - Default: `false`
50
+ */
51
+ bracketSameLine?: boolean | null;
52
+ /**
53
+ * Print spaces between brackets in object literals.
54
+ *
55
+ * - Default: `true`
56
+ */
57
+ bracketSpacing?: boolean | null;
58
+ /**
59
+ * Control whether to format embedded parts (For example, CSS-in-JS, or JS-in-Vue, etc.) in the file.
60
+ *
61
+ * NOTE: XXX-in-JS support is incomplete.
62
+ *
63
+ * - Default: `"auto"`
64
+ */
65
+ embeddedLanguageFormatting?: EmbeddedLanguageFormattingConfig | null;
66
+ /**
67
+ * Which end of line characters to apply.
68
+ *
69
+ * NOTE: `"auto"` is not supported.
70
+ *
71
+ * - Default: `"lf"`
72
+ * - Overrides `.editorconfig.end_of_line`
73
+ */
74
+ endOfLine?: EndOfLineConfig | null;
75
+ /**
76
+ * Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.
77
+ *
78
+ * - Default: `"css"`
79
+ */
80
+ htmlWhitespaceSensitivity?: HtmlWhitespaceSensitivityConfig | null;
81
+ /**
82
+ * Whether to insert a final newline at the end of the file.
83
+ *
84
+ * - Default: `true`
85
+ * - Overrides `.editorconfig.insert_final_newline`
86
+ */
87
+ insertFinalNewline?: boolean | null;
88
+ /**
89
+ * Use single quotes instead of double quotes in JSX.
90
+ *
91
+ * - Default: `false`
92
+ */
93
+ jsxSingleQuote?: boolean | null;
94
+ /**
95
+ * How to wrap object literals when they could fit on one line or span multiple lines.
96
+ *
97
+ * By default, formats objects as multi-line if there is a newline prior to the first property.
98
+ * Authors can use this heuristic to contextually improve readability, though it has some downsides.
99
+ *
100
+ * - Default: `"preserve"`
101
+ */
102
+ objectWrap?: ObjectWrapConfig | null;
103
+ /**
104
+ * Specify the line length that the printer will wrap on.
105
+ *
106
+ * If you don't want line wrapping when formatting Markdown, you can set the `proseWrap` option to disable it.
107
+ *
108
+ * - Default: `100`
109
+ * - Overrides `.editorconfig.max_line_length`
110
+ */
111
+ printWidth?: number | null;
112
+ /**
113
+ * How to wrap prose.
114
+ *
115
+ * By default, formatter will not change wrapping in markdown text since some services use a linebreak-sensitive renderer, e.g. GitHub comments and BitBucket.
116
+ * To wrap prose to the print width, change this option to "always".
117
+ * If you want to force all prose blocks to be on a single line and rely on editor/viewer soft wrapping instead, you can use "never".
118
+ *
119
+ * - Default: `"preserve"`
120
+ */
121
+ proseWrap?: ProseWrapConfig | null;
122
+ /**
123
+ * Change when properties in objects are quoted.
124
+ *
125
+ * - Default: `"as-needed"`
126
+ */
127
+ quoteProps?: QuotePropsConfig | null;
128
+ /**
129
+ * Print semicolons at the ends of statements.
130
+ *
131
+ * - Default: `true`
132
+ */
133
+ semi?: boolean | null;
134
+ /**
135
+ * Enforce single attribute per line in HTML, Vue, and JSX.
136
+ *
137
+ * - Default: `false`
138
+ */
139
+ singleAttributePerLine?: boolean | null;
140
+ /**
141
+ * Use single quotes instead of double quotes.
142
+ *
143
+ * For JSX, you can set the `jsxSingleQuote` option.
144
+ *
145
+ * - Default: `false`
146
+ */
147
+ singleQuote?: boolean | null;
148
+ /**
149
+ * Sort import statements.
150
+ *
151
+ * Using the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
152
+ * For details, see each field's documentation.
153
+ *
154
+ * - Default: Disabled
155
+ */
156
+ sortImports?: SortImportsConfig | null;
157
+ /**
158
+ * Sort `package.json` keys.
159
+ *
160
+ * The algorithm is NOT compatible with [prettier-plugin-sort-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson).
161
+ * But we believe it is clearer and easier to navigate.
162
+ * For details, see each field's documentation.
163
+ *
164
+ * - Default: `true`
165
+ */
166
+ sortPackageJson?: SortPackageJsonUserConfig | null;
167
+ /**
168
+ * Sort Tailwind CSS classes.
169
+ *
170
+ * Using the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).
171
+ * Option names omit the `tailwind` prefix used in the original plugin (e.g., `config` instead of `tailwindConfig`).
172
+ * For details, see each field's documentation.
173
+ *
174
+ * - Default: Disabled
175
+ */
176
+ sortTailwindcss?: SortTailwindcssConfig | null;
177
+ /**
178
+ * Specify the number of spaces per indentation-level.
179
+ *
180
+ * - Default: `2`
181
+ * - Overrides `.editorconfig.indent_size`
182
+ */
183
+ tabWidth?: number | null;
184
+ /**
185
+ * Print trailing commas wherever possible in multi-line comma-separated syntactic structures.
186
+ *
187
+ * A single-line array, for example, never gets trailing commas.
188
+ *
189
+ * - Default: `"all"`
190
+ */
191
+ trailingComma?: TrailingCommaConfig | null;
192
+ /**
193
+ * Indent lines with tabs instead of spaces.
194
+ *
195
+ * - Default: `false`
196
+ * - Overrides `.editorconfig.indent_style`
197
+ */
198
+ useTabs?: boolean | null;
199
+ /**
200
+ * Whether or not to indent the code inside `<script>` and `<style>` tags in Vue files.
201
+ *
202
+ * - Default: `false`
203
+ */
204
+ vueIndentScriptAndStyle?: boolean | null;
205
+ [k: string]: unknown;
206
+ }
207
+ interface SortImportsConfig {
208
+ /**
209
+ * Define your own groups for matching very specific imports.
210
+ *
211
+ * The `customGroups` list is ordered: The first definition that matches an element will be used.
212
+ * Custom groups have a higher priority than any predefined group.
213
+ *
214
+ * If you want a predefined group to take precedence over a custom group,
215
+ * you must write a custom group definition that does the same as what the predefined group does, and put it first in the list.
216
+ *
217
+ * If you specify multiple conditions like `elementNamePattern`, `selector`, and `modifiers`,
218
+ * all conditions must be met for an import to match the custom group (AND logic).
219
+ *
220
+ * - Default: `[]`
221
+ */
222
+ customGroups?: CustomGroupItemConfig[] | null;
223
+ /**
224
+ * Specifies a list of predefined import groups for sorting.
225
+ *
226
+ * Each import will be assigned a single group specified in the groups option (or the `unknown` group if no match is found).
227
+ * The order of items in the `groups` option determines how groups are ordered.
228
+ *
229
+ * Within a given group, members will be sorted according to the type, order, ignoreCase, etc. options.
230
+ *
231
+ * Individual groups can be combined together by placing them in an array.
232
+ * The order of groups in that array does not matter.
233
+ * All members of the groups in the array will be sorted together as if they were part of a single group.
234
+ *
235
+ * Predefined groups are characterized by a single selector and potentially multiple modifiers.
236
+ * You may enter modifiers in any order, but the selector must always come at the end.
237
+ *
238
+ * The list of selectors is sorted from most to least important:
239
+ * - `type` — TypeScript type imports.
240
+ * - `side_effect_style` — Side effect style imports.
241
+ * - `side_effect` — Side effect imports.
242
+ * - `style` — Style imports.
243
+ * - `index` — Main file from the current directory.
244
+ * - `sibling` — Modules from the same directory.
245
+ * - `parent` — Modules from the parent directory.
246
+ * - `subpath` — Node.js subpath imports.
247
+ * - `internal` — Your internal modules.
248
+ * - `builtin` — Node.js Built-in Modules.
249
+ * - `external` — External modules installed in the project.
250
+ * - `import` — Any import.
251
+ *
252
+ * The list of modifiers is sorted from most to least important:
253
+ * - `side_effect` — Side effect imports.
254
+ * - `type` — TypeScript type imports.
255
+ * - `value` — Value imports.
256
+ * - `default` — Imports containing the default specifier.
257
+ * - `wildcard` — Imports containing the wildcard (`* as`) specifier.
258
+ * - `named` — Imports containing at least one named specifier.
259
+ *
260
+ * - Default: See below
261
+ * ```json
262
+ * [
263
+ * "builtin",
264
+ * "external",
265
+ * ["internal", "subpath"],
266
+ * ["parent", "sibling", "index"],
267
+ * "style",
268
+ * "unknown"
269
+ * ]
270
+ * ```
271
+ *
272
+ * Also, you can override the global `newlinesBetween` setting for specific group boundaries
273
+ * by including a `{ "newlinesBetween": boolean }` marker object in the `groups` list at the desired position.
274
+ */
275
+ groups?: SortGroupItemConfig[] | null;
276
+ /**
277
+ * Specifies whether sorting should be case-sensitive.
278
+ *
279
+ * - Default: `true`
280
+ */
281
+ ignoreCase?: boolean | null;
282
+ /**
283
+ * Specifies a prefix for identifying internal imports.
284
+ *
285
+ * This is useful for distinguishing your own modules from external dependencies.
286
+ *
287
+ * - Default: `["~/", "@/"]`
288
+ */
289
+ internalPattern?: string[] | null;
290
+ /**
291
+ * Specifies whether to add newlines between groups.
292
+ *
293
+ * When `false`, no newlines are added between groups.
294
+ *
295
+ * - Default: `true`
296
+ */
297
+ newlinesBetween?: boolean | null;
298
+ /**
299
+ * Specifies whether to sort items in ascending or descending order.
300
+ *
301
+ * - Default: `"asc"`
302
+ */
303
+ order?: SortOrderConfig | null;
304
+ /**
305
+ * Enables the use of comments to separate imports into logical groups.
306
+ *
307
+ * When `true`, all comments will be treated as delimiters, creating partitions.
308
+ *
309
+ * ```js
310
+ * import { b1, b2 } from 'b'
311
+ * // PARTITION
312
+ * import { a } from 'a'
313
+ * import { c } from 'c'
314
+ * ```
315
+ *
316
+ * - Default: `false`
317
+ */
318
+ partitionByComment?: boolean | null;
319
+ /**
320
+ * Enables the empty line to separate imports into logical groups.
321
+ *
322
+ * When `true`, formatter will not sort imports if there is an empty line between them.
323
+ * This helps maintain the defined order of logically separated groups of members.
324
+ *
325
+ * ```js
326
+ * import { b1, b2 } from 'b'
327
+ *
328
+ * import { a } from 'a'
329
+ * import { c } from 'c'
330
+ * ```
331
+ *
332
+ * - Default: `false`
333
+ */
334
+ partitionByNewline?: boolean | null;
335
+ /**
336
+ * Specifies whether side effect imports should be sorted.
337
+ *
338
+ * By default, sorting side-effect imports is disabled for security reasons.
339
+ *
340
+ * - Default: `false`
341
+ */
342
+ sortSideEffects?: boolean | null;
343
+ [k: string]: unknown;
344
+ }
345
+ interface CustomGroupItemConfig {
346
+ /**
347
+ * List of glob patterns to match import sources for this group.
348
+ */
349
+ elementNamePattern?: string[];
350
+ /**
351
+ * Name of the custom group, used in the `groups` option.
352
+ */
353
+ groupName?: string;
354
+ /**
355
+ * Modifiers to match the import characteristics.
356
+ * All specified modifiers must be present (AND logic).
357
+ *
358
+ * Possible values: `"side_effect"`, `"type"`, `"value"`, `"default"`, `"wildcard"`, `"named"`
359
+ */
360
+ modifiers?: string[] | null;
361
+ /**
362
+ * Selector to match the import kind.
363
+ *
364
+ * Possible values: `"type"`, `"side_effect_style"`, `"side_effect"`, `"style"`, `"index"`,
365
+ * `"sibling"`, `"parent"`, `"subpath"`, `"internal"`, `"builtin"`, `"external"`, `"import"`
366
+ */
367
+ selector?: string | null;
368
+ [k: string]: unknown;
369
+ }
33
370
  /**
34
- * Format a JS/TS snippet for Prettier `textToDoc()` plugin flow.
371
+ * A marker object for overriding `newlinesBetween` at a specific group boundary.
35
372
  */
36
- declare function jsTextToDoc(sourceExt: string, sourceText: string, oxfmtPluginOptionsJson: string, parentContext: string): Promise<string | null>;
373
+ interface NewlinesBetweenMarker {
374
+ newlinesBetween: boolean;
375
+ [k: string]: unknown;
376
+ }
377
+ interface SortPackageJsonConfig {
378
+ /**
379
+ * Sort the `scripts` field alphabetically.
380
+ *
381
+ * - Default: `false`
382
+ */
383
+ sortScripts?: boolean | null;
384
+ [k: string]: unknown;
385
+ }
386
+ interface SortTailwindcssConfig {
387
+ /**
388
+ * List of additional attributes to sort beyond `class` and `className` (exact match).
389
+ *
390
+ * NOTE: Regex patterns are not yet supported.
391
+ *
392
+ * - Default: `[]`
393
+ * - Example: `["myClassProp", ":class"]`
394
+ */
395
+ attributes?: string[] | null;
396
+ /**
397
+ * Path to your Tailwind CSS configuration file (v3).
398
+ *
399
+ * NOTE: Paths are resolved relative to the Oxfmt configuration file.
400
+ *
401
+ * - Default: Automatically find `"tailwind.config.js"`
402
+ */
403
+ config?: string | null;
404
+ /**
405
+ * List of custom function names whose arguments should be sorted (exact match).
406
+ *
407
+ * NOTE: Regex patterns are not yet supported.
408
+ *
409
+ * - Default: `[]`
410
+ * - Example: `["clsx", "cn", "cva", "tw"]`
411
+ */
412
+ functions?: string[] | null;
413
+ /**
414
+ * Preserve duplicate classes.
415
+ *
416
+ * - Default: `false`
417
+ */
418
+ preserveDuplicates?: boolean | null;
419
+ /**
420
+ * Preserve whitespace around classes.
421
+ *
422
+ * - Default: `false`
423
+ */
424
+ preserveWhitespace?: boolean | null;
425
+ /**
426
+ * Path to your Tailwind CSS stylesheet (v4).
427
+ *
428
+ * NOTE: Paths are resolved relative to the Oxfmt configuration file.
429
+ *
430
+ * - Default: Installed Tailwind CSS's `theme.css`
431
+ */
432
+ stylesheet?: string | null;
433
+ [k: string]: unknown;
434
+ }
435
+ //#endregion
436
+ //#region src-js/index.d.ts
37
437
  /**
38
438
  * Configuration options for the `format()` API.
439
+ *
440
+ * Based on `FormatConfig` generated from the JSON Schema,
441
+ * with additional deprecated aliases for backward compatibility.
39
442
  */
40
- type FormatOptions = Pick<Options, "useTabs" | "tabWidth" | "singleQuote" | "jsxSingleQuote" | "quoteProps" | "trailingComma" | "semi" | "arrowParens" | "bracketSpacing" | "bracketSameLine" | "objectWrap" | "singleAttributePerLine" | "embeddedLanguageFormatting" | "proseWrap" | "htmlWhitespaceSensitivity" | "vueIndentScriptAndStyle"> & {
41
- /** Which end of line characters to apply. (Default: `"lf"`) */endOfLine?: "lf" | "crlf" | "cr"; /** The line length that the printer will wrap on. (Default: `100`) */
42
- printWidth?: number; /** Whether to insert a final newline at the end of the file. (Default: `true`) */
43
- insertFinalNewline?: boolean; /** Sort import statements. Disabled by default. */
44
- sortImports?: SortImportsOptions; /** @deprecated Use `sortImports` instead. */
45
- experimentalSortImports?: SortImportsOptions; /** Sort `package.json` keys. (Default: `true`) */
46
- sortPackageJson?: boolean | SortPackageJsonOptions; /** @deprecated Use `sortPackageJson` instead. */
47
- experimentalSortPackageJson?: boolean | SortPackageJsonOptions; /** Enable Tailwind CSS class sorting. (Default: disabled) */
48
- sortTailwindcss?: SortTailwindcssOptions; /** @deprecated Use `sortTailwindcss` instead. */
49
- experimentalTailwindcss?: SortTailwindcssOptions;
50
- } & Record<string, unknown>;
51
- /**
52
- * Configuration options for sort imports.
53
- */
54
- type SortImportsOptions = {
55
- /** Partition imports by newlines. (Default: `false`) */partitionByNewline?: boolean; /** Partition imports by comments. (Default: `false`) */
56
- partitionByComment?: boolean; /** Sort side-effect imports. (Default: `false`) */
57
- sortSideEffects?: boolean; /** Sort order. (Default: `"asc"`) */
58
- order?: "asc" | "desc"; /** Ignore case when sorting. (Default: `true`) */
59
- ignoreCase?: boolean; /** Add newlines between import groups. (Default: `true`) */
60
- newlinesBetween?: boolean; /** Prefixes to identify internal imports. (Default: `["~/", "@/"]`) */
61
- internalPattern?: string[];
62
- /**
63
- * Groups configuration for organizing imports.
64
- * Each array element represents a group, and multiple group names in the same array are treated as one.
65
- * Accepts `string`, `string[]`, or `{ newlinesBetween: boolean }` marker objects.
66
- * Marker objects override the global `newlinesBetween` setting for the boundary between the adjacent groups.
67
- */
68
- groups?: (string | string[] | {
69
- newlinesBetween: boolean;
70
- })[]; /** Define custom groups for matching specific imports. */
71
- customGroups?: {
72
- groupName: string;
73
- elementNamePattern?: string[];
74
- selector?: string;
75
- modifiers?: string[];
76
- }[];
443
+ type FormatOptions = FormatConfig & {
444
+ /** @deprecated Use `sortImports` instead. */experimentalSortImports?: SortImportsConfig; /** @deprecated Use `sortPackageJson` instead. */
445
+ experimentalSortPackageJson?: boolean | SortPackageJsonConfig; /** @deprecated Use `sortTailwindcss` instead. */
446
+ experimentalTailwindcss?: SortTailwindcssConfig;
77
447
  };
448
+ type SortImportsOptions = SortImportsConfig;
449
+ type SortPackageJsonOptions = SortPackageJsonConfig;
450
+ type SortTailwindcssOptions = SortTailwindcssConfig;
451
+ /** @deprecated Use `SortTailwindcssOptions` instead. */
452
+ type TailwindcssOptions = SortTailwindcssConfig;
78
453
  /**
79
- * Configuration options for sort package.json.
454
+ * Format the given source text according to the specified options.
80
455
  */
81
- type SortPackageJsonOptions = {
82
- /** Sort the `scripts` field alphabetically. (Default: `false`) */sortScripts?: boolean;
83
- };
456
+ declare function format(fileName: string, sourceText: string, options?: FormatOptions): Promise<FormatResult>;
84
457
  /**
85
- * Configuration options for Tailwind CSS class sorting.
86
- * See https://github.com/tailwindlabs/prettier-plugin-tailwindcss#options
458
+ * Format a JS/TS snippet for Prettier `textToDoc()` plugin flow.
87
459
  */
88
- type SortTailwindcssOptions = {
89
- /** Path to Tailwind config file (v3). e.g., `"./tailwind.config.js"` */config?: string; /** Path to Tailwind stylesheet (v4). e.g., `"./src/app.css"` */
90
- stylesheet?: string;
91
- /**
92
- * List of custom function names whose arguments should be sorted.
93
- * e.g., `["clsx", "cva", "tw"]` (Default: `[]`)
94
- */
95
- functions?: string[];
96
- /**
97
- * List of additional HTML/JSX attributes to sort (beyond `class` and `className`).
98
- * e.g., `["myClassProp", ":class"]` (Default: `[]`)
99
- */
100
- attributes?: string[]; /** Preserve whitespace around classes. (Default: `false`) */
101
- preserveWhitespace?: boolean; /** Preserve duplicate classes. (Default: `false`) */
102
- preserveDuplicates?: boolean;
103
- };
104
- /** @deprecated Use `SortTailwindcssOptions` instead. */
105
- type TailwindcssOptions = SortTailwindcssOptions;
460
+ declare function jsTextToDoc(sourceExt: string, sourceText: string, oxfmtPluginOptionsJson: string, parentContext: string): Promise<string | null>;
106
461
  //#endregion
107
462
  export { FormatOptions, SortImportsOptions, SortPackageJsonOptions, SortTailwindcssOptions, TailwindcssOptions, format, jsTextToDoc };
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
- import { n as jsTextToDoc$1, t as format$1 } from "./bindings-BY08Skk2.js";
2
- import { a as sortTailwindClasses, i as resolvePlugins, n as formatEmbeddedDoc, r as formatFile, t as formatEmbeddedCode } from "./apis-C04w0rkO.js";
3
-
1
+ import { n as jsTextToDoc$1, t as format$1 } from "./bindings-Cpav0PNl.js";
2
+ import { a as sortTailwindClasses, i as resolvePlugins, n as formatEmbeddedDoc, r as formatFile, t as formatEmbeddedCode } from "./apis-BoXLniqX.js";
4
3
  //#region src-js/index.ts
5
4
  /**
6
5
  * Format the given source text according to the specified options.
@@ -37,6 +36,5 @@ async function jsTextToDoc(sourceExt, sourceText, oxfmtPluginOptionsJson, parent
37
36
  classes
38
37
  }));
39
38
  }
40
-
41
39
  //#endregion
42
- export { format, jsTextToDoc };
40
+ export { format, jsTextToDoc };
@@ -1,5 +1,4 @@
1
- import { i as saveOxfmtrcFile, n as exitWithError, r as hasOxfmtrcFile, t as createBlankOxfmtrcFile } from "./shared-BhroZgjV.js";
2
-
1
+ import { i as saveOxfmtrcFile, n as exitWithError, r as hasOxfmtrcFile, t as createBlankOxfmtrcFile } from "./shared-BTEY2VsW.js";
3
2
  //#region src-js/cli/migration/init.ts
4
3
  /**
5
4
  * Run the `--init` command to scaffold a default `.oxfmtrc.json` file.
@@ -16,6 +15,5 @@ async function runInit() {
16
15
  return exitWithError("Failed to create `.oxfmtrc.json`.");
17
16
  }
18
17
  }
19
-
20
18
  //#endregion
21
- export { runInit };
19
+ export { runInit };