oxfmt 0.48.0 → 0.50.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 (50) hide show
  1. package/configuration_schema.json +70 -12
  2. package/dist/acorn-sBRpswSh.js +4972 -0
  3. package/dist/angular-DtI-eDW8.js +4004 -0
  4. package/dist/{apis-hnICGpKH.js → apis-CKvPKBJI.js} +51 -5
  5. package/dist/babel-DaNjvh9L.js +9885 -0
  6. package/dist/{bindings-DSOLttxo.js → bindings-Dj_YoR0Z.js} +26 -26
  7. package/dist/cli-worker.js +1 -1
  8. package/dist/cli.js +5 -5
  9. package/dist/{dist-DBVLDX4Z.js → dist-D_YbN99t.js} +19 -17
  10. package/dist/{estree-CvnLDdmw.js → estree-CzfNsl8m.js} +1914 -1911
  11. package/dist/flow-c9AjoQam.js +52916 -0
  12. package/dist/glimmer-D_zkI0w_.js +7533 -0
  13. package/dist/graphql-BFXkB4Nq.js +1944 -0
  14. package/dist/html-DkcPxRXg.js +7139 -0
  15. package/dist/index.d.ts +61 -5
  16. package/dist/index.js +2 -2
  17. package/dist/{init-BbKOMZ57.js → init-C3nxU_Wc.js} +1 -1
  18. package/dist/{jiti-Bb1dT6Cw-DpVi6yB1.js → jiti-Bb1dT6Cw-C0N20Za1.js} +5 -7
  19. package/dist/markdown-DVLNmbQg.js +6880 -0
  20. package/dist/{meriyah-CIaAh_Jq.js → meriyah-BGPf00Rn.js} +4649 -4647
  21. package/dist/{migrate-biome-BMqs7-eg.js → migrate-biome-DclTzwKW.js} +1 -1
  22. package/dist/{migrate-prettier-mSf_N9fW.js → migrate-prettier-DLfviW85.js} +2 -2
  23. package/dist/plugin-DOdiccQR.js +1914 -0
  24. package/dist/postcss-D-ql-dm8.js +6788 -0
  25. package/dist/prettier-Cw36juP9.js +15601 -0
  26. package/dist/{prettier-plugin-oxfmt-CLoiASgP.js → prettier-plugin-oxfmt-BlJcmKAv.js} +38 -3
  27. package/dist/{resolve-pWjAK-4f-BnvQ49el.js → sorter-BZkvDMjt-DpGe0QK9.js} +325 -4
  28. package/dist/{sorter-C3ZRVYzK.js → sorter-w0dgpoFw.js} +1 -2
  29. package/dist/typescript-C_eN_ThF.js +22899 -0
  30. package/dist/{v3-D-mr2VVh-DA8uo048.js → v3-D-mr2VVh-CU7hQIit.js} +3 -4
  31. package/dist/{v4-C-HWEQJm-olIGVWd7.js → v4-C-HWEQJm-C8EWwksG.js} +3 -4
  32. package/dist/yaml-Bqxyk-13.js +5280 -0
  33. package/package.json +28 -20
  34. package/dist/acorn-K_XpABqm.js +0 -4968
  35. package/dist/angular-B2OHapHD.js +0 -4057
  36. package/dist/babel-DA0BK-9N.js +0 -9883
  37. package/dist/chunk-DSjvVL_1-DvmJ8i3j.js +0 -36
  38. package/dist/chunk-DrSxFLj_.js +0 -14
  39. package/dist/flow-BthqNux8.js +0 -52912
  40. package/dist/glimmer-0WQITj6v.js +0 -7541
  41. package/dist/graphql-CZVKp936.js +0 -1945
  42. package/dist/html-CC61hPUL.js +0 -7137
  43. package/dist/markdown-BkJWkmO_.js +0 -6876
  44. package/dist/postcss-C8WoCp9x.js +0 -6785
  45. package/dist/prettier-DpEoE-3g.js +0 -15596
  46. package/dist/sorter-BZkvDMjt-CgLjPuXI.js +0 -212
  47. package/dist/typescript-Cg8onQ4r.js +0 -22936
  48. package/dist/utils-D8dQkKEd-CoIwOuFZ.js +0 -81
  49. package/dist/yaml-CTxkSwZx.js +0 -5281
  50. /package/dist/{shared-BTEY2VsW.js → shared-BtJbjkue.js} +0 -0
@@ -1,212 +0,0 @@
1
- import { a as resolveJsFrom, t as expiringMap } from "./resolve-pWjAK-4f-BnvQ49el.js";
2
- import { n as cacheForDirs, t as bigSign } from "./utils-D8dQkKEd-CoIwOuFZ.js";
3
- import { pathToFileURL } from "node:url";
4
- import * as path from "node:path";
5
- import { dirname, resolve } from "path";
6
- import { readdirSync, statSync } from "fs";
7
- //#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.3997fbd_prettier@3.8.3/node_modules/prettier-plugin-tailwindcss/dist/sorter-BZkvDMjt.mjs
8
- let seen = /* @__PURE__ */ new Set();
9
- function warn(key, arg, ...args) {
10
- if (seen.has(key)) return;
11
- seen.add(key);
12
- console.warn(arg, ...args);
13
- }
14
- function error(key, arg, ...args) {
15
- if (seen.has(key)) return;
16
- seen.add(key);
17
- console.error(arg, ...args);
18
- }
19
- function sync_default(start, callback) {
20
- let dir = resolve(".", start);
21
- let tmp;
22
- if (!statSync(dir).isDirectory()) dir = dirname(dir);
23
- while (true) {
24
- tmp = callback(dir, readdirSync(dir));
25
- if (tmp) return resolve(dir, tmp);
26
- dir = dirname(tmp = dir);
27
- if (tmp === dir) break;
28
- }
29
- }
30
- function sortClasses(classStr, { env, ignoreFirst = false, ignoreLast = false, removeDuplicates = true, collapseWhitespace = {
31
- start: true,
32
- end: true
33
- } }) {
34
- if (typeof classStr !== "string" || classStr === "") return classStr;
35
- if (classStr.includes("{{")) return classStr;
36
- if (env.options.tailwindPreserveWhitespace) collapseWhitespace = false;
37
- if (env.options.tailwindPreserveDuplicates) removeDuplicates = false;
38
- if (collapseWhitespace && /^[\t\r\f\n ]+$/.test(classStr)) return " ";
39
- let result = "";
40
- let parts = classStr.split(/([\t\r\f\n ]+)/);
41
- let classes = parts.filter((_, i) => i % 2 === 0);
42
- let whitespace = parts.filter((_, i) => i % 2 !== 0);
43
- if (classes[classes.length - 1] === "") classes.pop();
44
- if (collapseWhitespace) whitespace = whitespace.map(() => " ");
45
- let prefix = "";
46
- if (ignoreFirst) prefix = `${classes.shift() ?? ""}${whitespace.shift() ?? ""}`;
47
- let suffix = "";
48
- if (ignoreLast) suffix = `${whitespace.pop() ?? ""}${classes.pop() ?? ""}`;
49
- let { classList, removedIndices } = sortClassList({
50
- classList: classes,
51
- api: env.context,
52
- removeDuplicates
53
- });
54
- whitespace = whitespace.filter((_, index) => !removedIndices.has(index + 1));
55
- for (let i = 0; i < classList.length; i++) result += `${classList[i]}${whitespace[i] ?? ""}`;
56
- if (collapseWhitespace) {
57
- prefix = prefix.replace(/\s+$/g, " ");
58
- suffix = suffix.replace(/^\s+/g, " ");
59
- result = result.replace(/^\s+/, collapseWhitespace.start ? "" : " ").replace(/\s+$/, collapseWhitespace.end ? "" : " ");
60
- }
61
- return prefix + result + suffix;
62
- }
63
- function sortClassList({ classList, api, removeDuplicates }) {
64
- let orderedClasses = api.getClassOrder(classList);
65
- orderedClasses.sort(([nameA, a], [nameZ, z]) => {
66
- if (nameA === "..." || nameA === "…") return 1;
67
- if (nameZ === "..." || nameZ === "…") return -1;
68
- if (a === z) return 0;
69
- if (a === null) return -1;
70
- if (z === null) return 1;
71
- return bigSign(a - z);
72
- });
73
- let removedIndices = /* @__PURE__ */ new Set();
74
- if (removeDuplicates) {
75
- let seenClasses = /* @__PURE__ */ new Set();
76
- orderedClasses = orderedClasses.filter(([cls, order], index) => {
77
- if (seenClasses.has(cls)) {
78
- removedIndices.add(index);
79
- return false;
80
- }
81
- if (order !== null) seenClasses.add(cls);
82
- return true;
83
- });
84
- }
85
- return {
86
- classList: orderedClasses.map(([className]) => className),
87
- removedIndices
88
- };
89
- }
90
- function resolveIfRelative(base, filePath) {
91
- if (!filePath) return null;
92
- return path.isAbsolute(filePath) ? filePath : path.resolve(base, filePath);
93
- }
94
- let pathToApiMap = expiringMap(1e4);
95
- async function getTailwindConfig(options) {
96
- let base = options.base ?? process.cwd();
97
- let inputDir = options.filepath ? path.dirname(options.filepath) : base;
98
- let configPath = resolveIfRelative(base, options.configPath);
99
- let stylesheetPath = resolveIfRelative(base, options.stylesheetPath);
100
- let [mod, pkgDir] = await resolveTailwindPath({ packageName: options.packageName }, inputDir);
101
- let stylesheet = resolveStylesheet(stylesheetPath, base);
102
- let jsConfig = resolveJsConfigPath(configPath);
103
- if (!stylesheet && !(mod === null || mod === void 0 ? void 0 : mod.__unstable__loadDesignSystem)) jsConfig = jsConfig ?? findClosestJsConfig(inputDir);
104
- if (jsConfig) {
105
- if (!stylesheet) return pathToApiMap.remember(`${pkgDir}:${jsConfig}`, async () => {
106
- const { loadV3 } = await import("./v3-D-mr2VVh-DA8uo048.js");
107
- return loadV3(pkgDir, jsConfig);
108
- });
109
- error("explicit-stylesheet-and-config-together", base, `You have specified a Tailwind CSS stylesheet and a Tailwind CSS config at the same time. Use stylesheetPath unless you are using v3. Preferring the stylesheet.`);
110
- }
111
- if (mod && !mod.__unstable__loadDesignSystem) {
112
- if (!stylesheet) return pathToApiMap.remember(`${pkgDir}:${jsConfig}`, async () => {
113
- const { loadV3 } = await import("./v3-D-mr2VVh-DA8uo048.js");
114
- return loadV3(pkgDir, jsConfig);
115
- });
116
- mod = null;
117
- error("stylesheet-unsupported", base, "You have specified a Tailwind CSS stylesheet but your installed version of Tailwind CSS does not support this feature.");
118
- }
119
- if (mod && mod.__unstable__loadDesignSystem && pkgDir) stylesheet ?? (stylesheet = `${pkgDir}/theme.css`);
120
- return pathToApiMap.remember(`${pkgDir}:${stylesheet}`, async () => {
121
- const { loadV4 } = await import("./v4-C-HWEQJm-olIGVWd7.js");
122
- return loadV4(mod, stylesheet);
123
- });
124
- }
125
- let resolvedModCache = expiringMap(1e4);
126
- async function resolveTailwindPath(options, baseDir) {
127
- let pkgName = options.packageName ?? "tailwindcss";
128
- let makeKey = (dir) => `${pkgName}:${dir}`;
129
- let cached = resolvedModCache.get(makeKey(baseDir));
130
- if (cached !== void 0) return cached;
131
- let resolve = async () => {
132
- let pkgDir = null;
133
- let mod = null;
134
- try {
135
- mod = await import(pathToFileURL(resolveJsFrom(baseDir, pkgName)).toString());
136
- let pkgFile = resolveJsFrom(baseDir, `${pkgName}/package.json`);
137
- pkgDir = path.dirname(pkgFile);
138
- } catch {}
139
- return [mod, pkgDir];
140
- };
141
- let result = await resolve();
142
- let [, pkgDir] = result;
143
- if (pkgDir) cacheForDirs(resolvedModCache, baseDir, result, pkgDir, makeKey);
144
- else resolvedModCache.set(makeKey(baseDir), result);
145
- return result;
146
- }
147
- function resolveJsConfigPath(configPath) {
148
- if (!configPath) return null;
149
- if (configPath.endsWith(".css")) return null;
150
- return configPath;
151
- }
152
- let configPathCache = /* @__PURE__ */ new Map();
153
- function findClosestJsConfig(inputDir) {
154
- let cached = configPathCache.get(inputDir);
155
- if (cached !== void 0) return cached;
156
- let configPath = null;
157
- try {
158
- configPath = sync_default(inputDir, (_, names) => {
159
- if (names.includes("tailwind.config.js")) return "tailwind.config.js";
160
- if (names.includes("tailwind.config.cjs")) return "tailwind.config.cjs";
161
- if (names.includes("tailwind.config.mjs")) return "tailwind.config.mjs";
162
- if (names.includes("tailwind.config.ts")) return "tailwind.config.ts";
163
- }) ?? null;
164
- } catch {}
165
- if (configPath) cacheForDirs(configPathCache, inputDir, configPath, path.dirname(configPath));
166
- else configPathCache.set(inputDir, null);
167
- return configPath;
168
- }
169
- function resolveStylesheet(stylesheetPath, base) {
170
- if (!stylesheetPath) return null;
171
- if (stylesheetPath.endsWith(".js") || stylesheetPath.endsWith(".mjs") || stylesheetPath.endsWith(".cjs") || stylesheetPath.endsWith(".ts") || stylesheetPath.endsWith(".mts") || stylesheetPath.endsWith(".cts")) error("stylesheet-is-js-file", base, "Your `stylesheetPath` option points to a JS/TS config file. You must point to your project's `.css` file for v4 projects.");
172
- else if (stylesheetPath.endsWith(".sass") || stylesheetPath.endsWith(".scss") || stylesheetPath.endsWith(".less") || stylesheetPath.endsWith(".styl")) error("stylesheet-is-preprocessor-file", base, "Your `stylesheetPath` option points to a preprocessor file. This is unsupported and you may get unexpected results.");
173
- else if (!stylesheetPath.endsWith(".css")) error("stylesheet-is-not-css-file", base, "Your `stylesheetPath` option does not point to a CSS file. This is unsupported and you may get unexpected results.");
174
- return stylesheetPath;
175
- }
176
- async function createSorter(opts) {
177
- let preserveDuplicates = opts.preserveDuplicates ?? false;
178
- let preserveWhitespace = opts.preserveWhitespace ?? false;
179
- let api = await getTailwindConfig({
180
- base: opts.base,
181
- filepath: opts.filepath,
182
- configPath: opts.configPath,
183
- stylesheetPath: opts.stylesheetPath,
184
- packageName: opts.packageName
185
- });
186
- let env = {
187
- context: api,
188
- changes: [],
189
- options: {
190
- tailwindPreserveWhitespace: preserveWhitespace,
191
- tailwindPreserveDuplicates: preserveDuplicates,
192
- tailwindPackageName: opts.packageName
193
- },
194
- matcher: void 0
195
- };
196
- return {
197
- sortClassLists(classes) {
198
- return classes.map((list) => {
199
- return sortClassList({
200
- api,
201
- classList: list,
202
- removeDuplicates: !preserveDuplicates
203
- }).classList;
204
- });
205
- },
206
- sortClassAttributes(classes) {
207
- return classes.map((list) => sortClasses(list, { env }));
208
- }
209
- };
210
- }
211
- //#endregion
212
- export { sortClasses as a, sortClassList as i, error as n, warn as o, getTailwindConfig as r, createSorter as t };