oxfmt 0.50.0 → 0.52.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 (33) hide show
  1. package/dist/{acorn-sBRpswSh.js → acorn-C-l7ouWN.js} +1 -1
  2. package/dist/{angular-DtI-eDW8.js → angular-4Mc0TmPv.js} +3 -5
  3. package/dist/{apis-CKvPKBJI.js → apis-Cc9jzUH4.js} +7 -53
  4. package/dist/{babel-DaNjvh9L.js → babel-DjR61Wf3.js} +2 -3
  5. package/dist/{bindings-Dj_YoR0Z.js → bindings-BJw0GhQr.js} +26 -26
  6. package/dist/chunk-CNf5ZN-e.js +37 -0
  7. package/dist/cli-worker.js +1 -1
  8. package/dist/cli.js +79 -41
  9. package/dist/{dist-D_YbN99t.js → dist-CJyFMFm2.js} +70 -50
  10. package/dist/{estree-CzfNsl8m.js → estree-DHQPBKqf.js} +1 -1
  11. package/dist/{flow-c9AjoQam.js → flow-Cz3mJAtC.js} +1 -1
  12. package/dist/{glimmer-D_zkI0w_.js → glimmer-ubhL-0tG.js} +1 -1
  13. package/dist/{graphql-BFXkB4Nq.js → graphql-Cl0TIiHU.js} +1 -1
  14. package/dist/{html-DkcPxRXg.js → html-Cqnv8X__.js} +1 -1
  15. package/dist/index.js +4 -4
  16. package/dist/{init-C3nxU_Wc.js → init-DGfXRYLw.js} +1 -1
  17. package/dist/{jiti-Bb1dT6Cw-C0N20Za1.js → jiti-Bb1dT6Cw-B_5IaZk7.js} +2 -2
  18. package/dist/{markdown-DVLNmbQg.js → markdown-Eujfu-fQ.js} +1 -1
  19. package/dist/{meriyah-BGPf00Rn.js → meriyah-DESRG6oe.js} +1 -1
  20. package/dist/{migrate-biome-DclTzwKW.js → migrate-biome-P928W9-y.js} +1 -1
  21. package/dist/{migrate-prettier-DLfviW85.js → migrate-prettier-CotsZUFl.js} +2 -2
  22. package/dist/{plugin-DOdiccQR.js → plugin-C4twtOn4.js} +433 -374
  23. package/dist/{postcss-D-ql-dm8.js → postcss-BFLfznNY.js} +1 -1
  24. package/dist/{prettier-Cw36juP9.js → prettier-Cy-lZk4k.js} +15 -15
  25. package/dist/{sorter-BZkvDMjt-DpGe0QK9.js → sorter-BZkvDMjt-C3eOnP5z.js} +7 -7
  26. package/dist/{sorter-w0dgpoFw.js → sorter-CHFUGfz-.js} +1 -1
  27. package/dist/{typescript-C_eN_ThF.js → typescript-lqJOqGcK.js} +1 -1
  28. package/dist/{v3-D-mr2VVh-CU7hQIit.js → v3-D-mr2VVh-BXhnMySQ.js} +3 -3
  29. package/dist/{v4-C-HWEQJm-C8EWwksG.js → v4-C-HWEQJm-CvgekpKf.js} +3 -3
  30. package/dist/{yaml-Bqxyk-13.js → yaml-D3PpfZBy.js} +1 -1
  31. package/package.json +25 -21
  32. /package/dist/{prettier-plugin-oxfmt-BlJcmKAv.js → prettier-plugin-oxfmt-Dj6FaAil.js} +0 -0
  33. /package/dist/{shared-BtJbjkue.js → shared-BiMl-bLP.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { s as __esmMin } from "./apis-CKvPKBJI.js";
1
+ import { n as __esmMin } from "./chunk-CNf5ZN-e.js";
2
2
  //#region ../../node_modules/.pnpm/prettier@3.8.3/node_modules/prettier/plugins/acorn.mjs
3
3
  function je(e, t) {
4
4
  for (var i = 65536, s = 0; s < t.length; s += 2) {
@@ -1,4 +1,4 @@
1
- import { s as __esmMin } from "./apis-CKvPKBJI.js";
1
+ import { n as __esmMin } from "./chunk-CNf5ZN-e.js";
2
2
  //#region ../../node_modules/.pnpm/prettier@3.8.3/node_modules/prettier/plugins/angular.mjs
3
3
  function Fr(t) {
4
4
  return typeof t == "string" ? (e) => e === t : (e) => t.test(e);
@@ -3502,8 +3502,7 @@ var init_angular = __esmMin((() => {
3502
3502
  result: Ls()[t](e, n.sourceSpan, 0),
3503
3503
  comments: Hi(e)
3504
3504
  });
3505
- }, Rs = tt("parseAction"), $s = tt("parseBinding");
3506
- Ds = tt("parseInterpolationExpression"), Bs = (t) => {
3505
+ }, Rs = tt("parseAction"), $s = tt("parseBinding"), Ds = tt("parseInterpolationExpression"), Bs = (t) => {
3507
3506
  let e = Ps(t);
3508
3507
  return Ms({
3509
3508
  ...e,
@@ -3995,8 +3994,7 @@ var init_angular = __esmMin((() => {
3995
3994
  it = (t) => (e) => {
3996
3995
  let { result: n, comments: s } = t(e);
3997
3996
  return Object.assign(yr(n), { comments: s });
3998
- }, ot = it(Rs), cn = it($s);
3999
- un = it(Ds), pn = (t) => Lr(Bs(t).result.templateBindings, t);
3997
+ }, ot = it(Rs), cn = it($s), un = it(Ds), pn = (t) => Lr(Bs(t).result.templateBindings, t);
4000
3998
  no = at(ot), so = at(cn), ro = at(un), io = at(pn);
4001
3999
  }));
4002
4000
  //#endregion
@@ -1,39 +1,4 @@
1
- import { createRequire } from "node:module";
2
- //#region \0rolldown/runtime.js
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
10
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
11
- var __exportAll = (all, no_symbols) => {
12
- let target = {};
13
- for (var name in all) __defProp(target, name, {
14
- get: all[name],
15
- enumerable: true
16
- });
17
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- return target;
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
22
- key = keys[i];
23
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
24
- get: ((k) => from[k]).bind(null, key),
25
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
26
- });
27
- }
28
- return to;
29
- };
30
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
- value: mod,
32
- enumerable: true
33
- }) : target, mod));
34
- var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
36
- //#endregion
1
+ import { o as __toESM } from "./chunk-CNf5ZN-e.js";
37
2
  //#region src-js/libs/apis.ts
38
3
  const CACHES = {
39
4
  prettier: null,
@@ -48,7 +13,7 @@ async function loadCached(key, loader) {
48
13
  }
49
14
  async function loadPrettier() {
50
15
  return loadCached("prettier", async () => {
51
- const prettier = await import("./prettier-Cw36juP9.js");
16
+ const prettier = await import("./prettier-Cy-lZk4k.js");
52
17
  const { formatOptionsHiddenDefaults } = prettier.__internal;
53
18
  formatOptionsHiddenDefaults.parentParser = null;
54
19
  formatOptionsHiddenDefaults.__onHtmlRoot = null;
@@ -57,17 +22,6 @@ async function loadPrettier() {
57
22
  });
58
23
  }
59
24
  /**
60
- * TODO: Plugins support
61
- * - Read `plugins` field
62
- * - Load plugins dynamically and parse `languages` field
63
- * - Map file extensions and filenames to Prettier parsers
64
- *
65
- * @returns Array of loaded plugin's `languages` info
66
- */
67
- async function resolvePlugins() {
68
- return [];
69
- }
70
- /**
71
25
  * Format non-js file
72
26
  *
73
27
  * @returns Formatted code
@@ -130,7 +84,7 @@ async function formatEmbeddedDoc({ texts, options }) {
130
84
  * Option mapping (sortTailwindcss.xxx → tailwindXxx) is also done in Rust side.
131
85
  */
132
86
  async function setupTailwindPlugin(options) {
133
- CACHES.tailwindPlugin ??= await loadCached("tailwindPlugin", () => import("./dist-D_YbN99t.js"));
87
+ CACHES.tailwindPlugin ??= await loadCached("tailwindPlugin", () => import("./dist-CJyFMFm2.js"));
134
88
  options.plugins ??= [];
135
89
  options.plugins.push(CACHES.tailwindPlugin);
136
90
  }
@@ -140,7 +94,7 @@ async function setupTailwindPlugin(options) {
140
94
  * @returns Array of sorted class strings (same order/length as input)
141
95
  */
142
96
  async function sortTailwindClasses({ classes, options }) {
143
- CACHES.tailwindSorter ??= await loadCached("tailwindSorter", () => import("./sorter-w0dgpoFw.js"));
97
+ CACHES.tailwindSorter ??= await loadCached("tailwindSorter", () => import("./sorter-CHFUGfz-.js"));
144
98
  const { createSorter } = CACHES.tailwindSorter;
145
99
  return (await createSorter({
146
100
  filepath: options.filepath,
@@ -154,7 +108,7 @@ async function sortTailwindClasses({ classes, options }) {
154
108
  * Load prettier-plugin-svelte to provide the `svelte` parser.
155
109
  */
156
110
  async function setupSveltePlugin(options) {
157
- CACHES.sveltePlugin ??= await loadCached("sveltePlugin", async () => await import("./plugin-DOdiccQR.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)));
111
+ CACHES.sveltePlugin ??= await loadCached("sveltePlugin", async () => await import("./plugin-C4twtOn4.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)));
158
112
  options.plugins ??= [];
159
113
  options.plugins.push(CACHES.sveltePlugin);
160
114
  }
@@ -162,9 +116,9 @@ async function setupSveltePlugin(options) {
162
116
  * Load oxfmt plugin for js-in-xxx parsers.
163
117
  */
164
118
  async function setupOxfmtPlugin(options) {
165
- CACHES.oxfmtPlugin ??= await loadCached("oxfmtPlugin", async () => await import("./prettier-plugin-oxfmt-BlJcmKAv.js"));
119
+ CACHES.oxfmtPlugin ??= await loadCached("oxfmtPlugin", async () => await import("./prettier-plugin-oxfmt-Dj6FaAil.js"));
166
120
  options.plugins ??= [];
167
121
  options.plugins.push(CACHES.oxfmtPlugin);
168
122
  }
169
123
  //#endregion
170
- export { sortTailwindClasses as a, __exportAll as c, __toESM as d, resolvePlugins as i, __require as l, formatEmbeddedDoc as n, __commonJSMin as o, formatFile as r, __esmMin as s, formatEmbeddedCode as t, __toCommonJS as u };
124
+ export { sortTailwindClasses as i, formatEmbeddedDoc as n, formatFile as r, formatEmbeddedCode as t };
@@ -1,4 +1,4 @@
1
- import { c as __exportAll, s as __esmMin } from "./apis-CKvPKBJI.js";
1
+ import { n as __esmMin, r as __exportAll } from "./chunk-CNf5ZN-e.js";
2
2
  //#region ../../node_modules/.pnpm/prettier@3.8.3/node_modules/prettier/plugins/babel.mjs
3
3
  var babel_exports = /* @__PURE__ */ __exportAll({
4
4
  default: () => Ks,
@@ -9057,8 +9057,7 @@ var init_babel = __esmMin((() => {
9057
9057
  };
9058
9058
  ar(oi);
9059
9059
  Wt = /* @__PURE__ */ new Map();
9060
- cs = ke(" ");
9061
- ls = ke(/[^\n\r]/u);
9060
+ cs = ke(" "), ls = ke(/[^\n\r]/u);
9062
9061
  ps = or;
9063
9062
  us = (a) => a === `
9064
9063
  ` || a === "\r" || a === "\u2028" || a === "\u2029";
@@ -57,7 +57,7 @@ function requireNative() {
57
57
  try {
58
58
  const binding = require("@oxfmt/binding-android-arm64");
59
59
  const bindingPackageVersion = require("@oxfmt/binding-android-arm64/package.json").version;
60
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
60
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
61
61
  return binding;
62
62
  } catch (e) {
63
63
  loadErrors.push(e);
@@ -71,7 +71,7 @@ function requireNative() {
71
71
  try {
72
72
  const binding = require("@oxfmt/binding-android-arm-eabi");
73
73
  const bindingPackageVersion = require("@oxfmt/binding-android-arm-eabi/package.json").version;
74
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
74
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
75
75
  return binding;
76
76
  } catch (e) {
77
77
  loadErrors.push(e);
@@ -86,7 +86,7 @@ function requireNative() {
86
86
  try {
87
87
  const binding = require("@oxfmt/binding-win32-x64-gnu");
88
88
  const bindingPackageVersion = require("@oxfmt/binding-win32-x64-gnu/package.json").version;
89
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
89
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
90
90
  return binding;
91
91
  } catch (e) {
92
92
  loadErrors.push(e);
@@ -100,7 +100,7 @@ function requireNative() {
100
100
  try {
101
101
  const binding = require("@oxfmt/binding-win32-x64-msvc");
102
102
  const bindingPackageVersion = require("@oxfmt/binding-win32-x64-msvc/package.json").version;
103
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
103
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
104
104
  return binding;
105
105
  } catch (e) {
106
106
  loadErrors.push(e);
@@ -115,7 +115,7 @@ function requireNative() {
115
115
  try {
116
116
  const binding = require("@oxfmt/binding-win32-ia32-msvc");
117
117
  const bindingPackageVersion = require("@oxfmt/binding-win32-ia32-msvc/package.json").version;
118
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
118
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
119
119
  return binding;
120
120
  } catch (e) {
121
121
  loadErrors.push(e);
@@ -129,7 +129,7 @@ function requireNative() {
129
129
  try {
130
130
  const binding = require("@oxfmt/binding-win32-arm64-msvc");
131
131
  const bindingPackageVersion = require("@oxfmt/binding-win32-arm64-msvc/package.json").version;
132
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
132
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
133
133
  return binding;
134
134
  } catch (e) {
135
135
  loadErrors.push(e);
@@ -144,7 +144,7 @@ function requireNative() {
144
144
  try {
145
145
  const binding = require("@oxfmt/binding-darwin-universal");
146
146
  const bindingPackageVersion = require("@oxfmt/binding-darwin-universal/package.json").version;
147
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
147
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
148
148
  return binding;
149
149
  } catch (e) {
150
150
  loadErrors.push(e);
@@ -158,7 +158,7 @@ function requireNative() {
158
158
  try {
159
159
  const binding = require("@oxfmt/binding-darwin-x64");
160
160
  const bindingPackageVersion = require("@oxfmt/binding-darwin-x64/package.json").version;
161
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
161
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
162
162
  return binding;
163
163
  } catch (e) {
164
164
  loadErrors.push(e);
@@ -172,7 +172,7 @@ function requireNative() {
172
172
  try {
173
173
  const binding = require("@oxfmt/binding-darwin-arm64");
174
174
  const bindingPackageVersion = require("@oxfmt/binding-darwin-arm64/package.json").version;
175
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
175
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
176
176
  return binding;
177
177
  } catch (e) {
178
178
  loadErrors.push(e);
@@ -187,7 +187,7 @@ function requireNative() {
187
187
  try {
188
188
  const binding = require("@oxfmt/binding-freebsd-x64");
189
189
  const bindingPackageVersion = require("@oxfmt/binding-freebsd-x64/package.json").version;
190
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
190
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
191
191
  return binding;
192
192
  } catch (e) {
193
193
  loadErrors.push(e);
@@ -201,7 +201,7 @@ function requireNative() {
201
201
  try {
202
202
  const binding = require("@oxfmt/binding-freebsd-arm64");
203
203
  const bindingPackageVersion = require("@oxfmt/binding-freebsd-arm64/package.json").version;
204
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
204
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
205
205
  return binding;
206
206
  } catch (e) {
207
207
  loadErrors.push(e);
@@ -216,7 +216,7 @@ function requireNative() {
216
216
  try {
217
217
  const binding = require("@oxfmt/binding-linux-x64-musl");
218
218
  const bindingPackageVersion = require("@oxfmt/binding-linux-x64-musl/package.json").version;
219
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
219
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
220
220
  return binding;
221
221
  } catch (e) {
222
222
  loadErrors.push(e);
@@ -230,7 +230,7 @@ function requireNative() {
230
230
  try {
231
231
  const binding = require("@oxfmt/binding-linux-x64-gnu");
232
232
  const bindingPackageVersion = require("@oxfmt/binding-linux-x64-gnu/package.json").version;
233
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
233
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
234
234
  return binding;
235
235
  } catch (e) {
236
236
  loadErrors.push(e);
@@ -245,7 +245,7 @@ function requireNative() {
245
245
  try {
246
246
  const binding = require("@oxfmt/binding-linux-arm64-musl");
247
247
  const bindingPackageVersion = require("@oxfmt/binding-linux-arm64-musl/package.json").version;
248
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
248
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
249
249
  return binding;
250
250
  } catch (e) {
251
251
  loadErrors.push(e);
@@ -259,7 +259,7 @@ function requireNative() {
259
259
  try {
260
260
  const binding = require("@oxfmt/binding-linux-arm64-gnu");
261
261
  const bindingPackageVersion = require("@oxfmt/binding-linux-arm64-gnu/package.json").version;
262
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
262
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
263
263
  return binding;
264
264
  } catch (e) {
265
265
  loadErrors.push(e);
@@ -274,7 +274,7 @@ function requireNative() {
274
274
  try {
275
275
  const binding = require("@oxfmt/binding-linux-arm-musleabihf");
276
276
  const bindingPackageVersion = require("@oxfmt/binding-linux-arm-musleabihf/package.json").version;
277
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
277
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
278
278
  return binding;
279
279
  } catch (e) {
280
280
  loadErrors.push(e);
@@ -288,7 +288,7 @@ function requireNative() {
288
288
  try {
289
289
  const binding = require("@oxfmt/binding-linux-arm-gnueabihf");
290
290
  const bindingPackageVersion = require("@oxfmt/binding-linux-arm-gnueabihf/package.json").version;
291
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
291
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
292
292
  return binding;
293
293
  } catch (e) {
294
294
  loadErrors.push(e);
@@ -303,7 +303,7 @@ function requireNative() {
303
303
  try {
304
304
  const binding = require("@oxfmt/binding-linux-loong64-musl");
305
305
  const bindingPackageVersion = require("@oxfmt/binding-linux-loong64-musl/package.json").version;
306
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
306
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
307
307
  return binding;
308
308
  } catch (e) {
309
309
  loadErrors.push(e);
@@ -317,7 +317,7 @@ function requireNative() {
317
317
  try {
318
318
  const binding = require("@oxfmt/binding-linux-loong64-gnu");
319
319
  const bindingPackageVersion = require("@oxfmt/binding-linux-loong64-gnu/package.json").version;
320
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
320
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
321
321
  return binding;
322
322
  } catch (e) {
323
323
  loadErrors.push(e);
@@ -332,7 +332,7 @@ function requireNative() {
332
332
  try {
333
333
  const binding = require("@oxfmt/binding-linux-riscv64-musl");
334
334
  const bindingPackageVersion = require("@oxfmt/binding-linux-riscv64-musl/package.json").version;
335
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
335
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
336
336
  return binding;
337
337
  } catch (e) {
338
338
  loadErrors.push(e);
@@ -346,7 +346,7 @@ function requireNative() {
346
346
  try {
347
347
  const binding = require("@oxfmt/binding-linux-riscv64-gnu");
348
348
  const bindingPackageVersion = require("@oxfmt/binding-linux-riscv64-gnu/package.json").version;
349
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
349
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
350
350
  return binding;
351
351
  } catch (e) {
352
352
  loadErrors.push(e);
@@ -361,7 +361,7 @@ function requireNative() {
361
361
  try {
362
362
  const binding = require("@oxfmt/binding-linux-ppc64-gnu");
363
363
  const bindingPackageVersion = require("@oxfmt/binding-linux-ppc64-gnu/package.json").version;
364
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
364
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
365
365
  return binding;
366
366
  } catch (e) {
367
367
  loadErrors.push(e);
@@ -375,7 +375,7 @@ function requireNative() {
375
375
  try {
376
376
  const binding = require("@oxfmt/binding-linux-s390x-gnu");
377
377
  const bindingPackageVersion = require("@oxfmt/binding-linux-s390x-gnu/package.json").version;
378
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
378
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
379
379
  return binding;
380
380
  } catch (e) {
381
381
  loadErrors.push(e);
@@ -390,7 +390,7 @@ function requireNative() {
390
390
  try {
391
391
  const binding = require("@oxfmt/binding-openharmony-arm64");
392
392
  const bindingPackageVersion = require("@oxfmt/binding-openharmony-arm64/package.json").version;
393
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
393
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
394
394
  return binding;
395
395
  } catch (e) {
396
396
  loadErrors.push(e);
@@ -404,7 +404,7 @@ function requireNative() {
404
404
  try {
405
405
  const binding = require("@oxfmt/binding-openharmony-x64");
406
406
  const bindingPackageVersion = require("@oxfmt/binding-openharmony-x64/package.json").version;
407
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
407
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
408
408
  return binding;
409
409
  } catch (e) {
410
410
  loadErrors.push(e);
@@ -418,7 +418,7 @@ function requireNative() {
418
418
  try {
419
419
  const binding = require("@oxfmt/binding-openharmony-arm");
420
420
  const bindingPackageVersion = require("@oxfmt/binding-openharmony-arm/package.json").version;
421
- if (bindingPackageVersion !== "0.50.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.50.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
421
+ if (bindingPackageVersion !== "0.52.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.52.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
422
422
  return binding;
423
423
  } catch (e) {
424
424
  loadErrors.push(e);
@@ -0,0 +1,37 @@
1
+ import { createRequire } from "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
10
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
11
+ var __exportAll = (all, no_symbols) => {
12
+ let target = {};
13
+ for (var name in all) __defProp(target, name, {
14
+ get: all[name],
15
+ enumerable: true
16
+ });
17
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ return target;
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
22
+ key = keys[i];
23
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
24
+ get: ((k) => from[k]).bind(null, key),
25
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
26
+ });
27
+ }
28
+ return to;
29
+ };
30
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
+ value: mod,
32
+ enumerable: true
33
+ }) : target, mod));
34
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
36
+ //#endregion
37
+ export { __toCommonJS as a, __require as i, __esmMin as n, __toESM as o, __exportAll as r, __commonJSMin as t };
@@ -1,2 +1,2 @@
1
- import { a as sortTailwindClasses, n as formatEmbeddedDoc, r as formatFile, t as formatEmbeddedCode } from "./apis-CKvPKBJI.js";
1
+ import { i as sortTailwindClasses, n as formatEmbeddedDoc, r as formatFile, t as formatEmbeddedCode } from "./apis-Cc9jzUH4.js";
2
2
  export { formatEmbeddedCode, formatEmbeddedDoc, formatFile, sortTailwindClasses };
package/dist/cli.js CHANGED
@@ -1,5 +1,4 @@
1
- import { i as resolvePlugins } from "./apis-CKvPKBJI.js";
2
- import { r as runCli } from "./bindings-Dj_YoR0Z.js";
1
+ import { r as runCli } from "./bindings-BJw0GhQr.js";
3
2
  import Tinypool from "tinypool";
4
3
  import { fileURLToPath, pathToFileURL } from "node:url";
5
4
  import { extname } from "node:path";
@@ -13,7 +12,6 @@ async function initExternalFormatter(numThreads) {
13
12
  runtime: "child_process",
14
13
  env: process.env
15
14
  });
16
- return resolvePlugins();
17
15
  }
18
16
  async function disposeExternalFormatter() {
19
17
  await pool?.destroy();
@@ -53,21 +51,16 @@ async function sortTailwindClasses(options, classes) {
53
51
  }, { name: "sortTailwindClasses" }).catch(() => null);
54
52
  }
55
53
  //#endregion
56
- //#region src-js/cli/js_config/node_version.ts
57
- const NODE_TYPESCRIPT_SUPPORT_RANGE = "^20.19.0 || >=22.12.0";
54
+ //#region ../shared/src-js/utils.ts
55
+ const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
56
+ //#endregion
57
+ //#region ../shared/src-js/js_config/node_version.ts
58
+ const NODE_TYPESCRIPT_SUPPORT_RANGE = "^20.19.0 || >=22.18.0";
58
59
  const TS_MODULE_EXTENSIONS = new Set([
59
60
  ".ts",
60
61
  ".mts",
61
62
  ".cts"
62
63
  ]);
63
- function getUnsupportedTypeScriptModuleLoadHint(err, specifier, nodeVersion = process.version) {
64
- if (!isTypeScriptModuleSpecifier(specifier) || !isUnknownFileExtensionError(err)) return null;
65
- return `TypeScript config files require Node.js ${NODE_TYPESCRIPT_SUPPORT_RANGE}.\nDetected Node.js ${nodeVersion}.\nPlease upgrade Node.js or use a JSON config file instead.`;
66
- }
67
- function isTypeScriptModuleSpecifier(specifier) {
68
- const ext = extname(normalizeModuleSpecifierPath(specifier)).toLowerCase();
69
- return TS_MODULE_EXTENSIONS.has(ext);
70
- }
71
64
  function normalizeModuleSpecifierPath(specifier) {
72
65
  if (!specifier.startsWith("file:")) return specifier;
73
66
  try {
@@ -76,31 +69,84 @@ function normalizeModuleSpecifierPath(specifier) {
76
69
  return specifier;
77
70
  }
78
71
  }
72
+ function isTypeScriptModuleSpecifier(specifier) {
73
+ const ext = extname(normalizeModuleSpecifierPath(specifier)).toLowerCase();
74
+ return TS_MODULE_EXTENSIONS.has(ext);
75
+ }
79
76
  function isUnknownFileExtensionError(err) {
80
77
  if (err?.code === "ERR_UNKNOWN_FILE_EXTENSION") return true;
81
78
  const message = err?.message;
82
79
  return typeof message === "string" && /unknown(?: or unsupported)? file extension/i.test(message);
83
80
  }
81
+ function getErrorMessage(err) {
82
+ if (err instanceof Error) return err.message;
83
+ return String(err);
84
+ }
85
+ /**
86
+ * Returns a complete replacement string suitable for `Error.message` assignment
87
+ * (includes the original error message + appended hint), or `null` when the
88
+ * error is unrelated to TS module loading. Callers should overwrite, not append.
89
+ */
90
+ function getUnsupportedTypeScriptModuleLoadHintForError(err, specifier, nodeVersion = process.version) {
91
+ if (!isTypeScriptModuleSpecifier(specifier) || !isUnknownFileExtensionError(err)) return null;
92
+ return `${getErrorMessage(err)}\n\nTypeScript config files require Node.js ${NODE_TYPESCRIPT_SUPPORT_RANGE}.\nDetected Node.js ${nodeVersion}.\nPlease upgrade Node.js or use a JSON config file instead.`;
93
+ }
84
94
  //#endregion
85
- //#region src-js/cli/js_config/index.ts
86
- const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
95
+ //#region ../shared/src-js/js_config/index.ts
87
96
  /**
88
- * Load a JavaScript/TypeScript config file and import it.
97
+ * Import a JS/TS config file and return its `default` export as a plain object.
98
+ *
99
+ * - Bypasses Node.js module cache (uses `?cache=<key>`) so changed files reload (used for LSP).
100
+ * - On `ERR_UNKNOWN_FILE_EXTENSION` for TS specifiers, wraps the error with a Node.js upgrade hint message;
101
+ * The original error is preserved via `Error.cause`.
89
102
  *
90
- * Uses native Node.js `import()` to evaluate the config file.
91
- * The config file should have a default export containing the oxfmt configuration object.
103
+ * @param path - Absolute path to the JS/TS config file
104
+ * @param cacheKey - Cache-busting key.
105
+ * Callers decide whether to use a fresh value per call or share one across a batch.
106
+ * @throws When the file has no `default` export, the export is not a plain object,
107
+ * or import fails (wrapped with hint message for unsupported TS module load).
92
108
  */
93
- async function importJsConfig(path) {
109
+ async function importJsConfig(path, cacheKey) {
94
110
  const fileUrl = pathToFileURL(path);
95
- fileUrl.searchParams.set("cache", Date.now().toString());
96
- const { default: config } = await import(fileUrl.href).catch((err) => {
97
- const hint = getUnsupportedTypeScriptModuleLoadHint(err, path);
98
- if (hint && err instanceof Error) err.message += `\n\n${hint}`;
111
+ fileUrl.searchParams.set("cache", cacheKey.toString());
112
+ let module;
113
+ try {
114
+ module = await import(fileUrl.href);
115
+ } catch (err) {
116
+ const hint = getUnsupportedTypeScriptModuleLoadHintForError(err, path);
117
+ if (hint) throw new Error(hint, { cause: err });
99
118
  throw err;
100
- });
101
- if (config === void 0) throw new Error("Configuration file has no default export.");
102
- return config;
119
+ }
120
+ if (module.default === void 0) throw new Error("Configuration file has no default export.");
121
+ if (!isObject(module.default)) throw new Error("Configuration file must have a default export that is an object.");
122
+ return module.default;
103
123
  }
124
+ //#endregion
125
+ //#region ../shared/src-js/vite_plus_config.ts
126
+ let vitePlusCache = null;
127
+ /**
128
+ * Resolve a Vite+ config via `vite-plus`'s `resolveConfig` and extract the given field.
129
+ *
130
+ * `vite-plus` is loaded lazily and memoized for the process.
131
+ * Consumers declare it as an optional peer dependency; tsdown leaves the specifier external
132
+ * so the user-installed copy is used at runtime.
133
+ *
134
+ * @param path - Absolute path to the Vite config file
135
+ * @param fieldName - Field name to extract from the resolved config (e.g. `"fmt"`, `"lint"`)
136
+ * @returns The field as an object, or `null` when the field is missing (signals "skip")
137
+ * @throws When the field exists but is not a plain object
138
+ */
139
+ async function loadViteConfigField(path, fieldName) {
140
+ vitePlusCache ??= import("vite-plus");
141
+ const { resolveConfig } = await vitePlusCache;
142
+ const config = await resolveConfig({ configFile: path }, "build");
143
+ if (!(fieldName in config)) return null;
144
+ const fieldValue = config[fieldName];
145
+ if (!isObject(fieldValue)) throw new Error(`The \`${fieldName}\` field in the default export must be an object.`);
146
+ return fieldValue;
147
+ }
148
+ //#endregion
149
+ //#region src-js/cli/js_config.ts
104
150
  /**
105
151
  * Load and validate a standard oxfmt JS/TS config file.
106
152
  * The default export must be a plain object containing oxfmt options.
@@ -108,25 +154,17 @@ async function importJsConfig(path) {
108
154
  * @param path - Absolute path to the JavaScript/TypeScript config file
109
155
  * @returns Config object
110
156
  */
111
- async function loadJsConfig(path) {
112
- const config = await importJsConfig(path);
113
- if (!isObject(config)) throw new Error("Configuration file must have a default export that is an object.");
114
- return config;
157
+ function loadJsConfig(path) {
158
+ return importJsConfig(path, Date.now());
115
159
  }
116
- const VITE_OXFMT_CONFIG_FIELD = "fmt";
117
160
  /**
118
- * Load a Vite+ config file (`vite.config.ts`) and extract the `.fmt` field.
161
+ * Load a Vite+ config file (`vite.config.ts`) via `vite-plus`'s `resolveConfig` and extract the `.fmt` field.
119
162
  *
120
163
  * @param path - Absolute path to the Vite config file
121
164
  * @returns Config object from `.fmt` field, or `null` to signal "skip"
122
165
  */
123
166
  async function loadVitePlusConfig(path) {
124
- const config = await importJsConfig(path);
125
- if (!isObject(config)) return null;
126
- const fmtConfig = config[VITE_OXFMT_CONFIG_FIELD];
127
- if (fmtConfig === void 0) return null;
128
- if (!isObject(fmtConfig)) throw new Error(`The \`${VITE_OXFMT_CONFIG_FIELD}\` field in the default export must be an object.`);
129
- return fmtConfig;
167
+ return loadViteConfigField(path, "fmt");
130
168
  }
131
169
  //#endregion
132
170
  //#region src-js/cli.ts
@@ -137,15 +175,15 @@ async function loadVitePlusConfig(path) {
137
175
  if (args.includes("--lsp")) process.stdout.write = process.stderr.write.bind(process.stderr);
138
176
  const [mode, exitCode] = await runCli(args, process.env.VP_VERSION ? loadVitePlusConfig : loadJsConfig, initExternalFormatter, formatFile, formatEmbeddedCode, formatEmbeddedDoc, sortTailwindClasses);
139
177
  if (mode === "init") {
140
- await import("./init-C3nxU_Wc.js").then((m) => m.runInit());
178
+ await import("./init-DGfXRYLw.js").then((m) => m.runInit());
141
179
  return;
142
180
  }
143
181
  if (mode === "migrate:prettier") {
144
- await import("./migrate-prettier-DLfviW85.js").then((m) => m.runMigratePrettier());
182
+ await import("./migrate-prettier-CotsZUFl.js").then((m) => m.runMigratePrettier());
145
183
  return;
146
184
  }
147
185
  if (mode === "migrate:biome") {
148
- await import("./migrate-biome-DclTzwKW.js").then((m) => m.runMigrateBiome());
186
+ await import("./migrate-biome-P928W9-y.js").then((m) => m.runMigrateBiome());
149
187
  return;
150
188
  }
151
189
  await disposeExternalFormatter();