oxfmt 0.49.0 → 0.51.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.
- package/configuration_schema.json +2 -2
- package/dist/{apis-By1xj7IP.js → apis-H4bwlBNm.js} +6 -17
- package/dist/{bindings-Cdg_nxGV.js → bindings-qpSSlUMn.js} +26 -26
- package/dist/cli-worker.js +1 -1
- package/dist/cli.js +48 -29
- package/dist/{dist-Bbs0xV9H.js → dist-DieWQ1D0.js} +12 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/{jiti-Bb1dT6Cw-DezGRPD7.js → jiti-Bb1dT6Cw-BtDs_aWX.js} +2 -2
- package/dist/{migrate-prettier-Bze9N_6F.js → migrate-prettier-CBzqnxHw.js} +1 -1
- package/dist/{plugin-CwlqDRt_.js → plugin-DiRKvkOT.js} +70 -26
- package/dist/{prettier-s1WPCGVk.js → prettier-D7Ly-aG0.js} +13 -13
- package/dist/{prettier-plugin-oxfmt-BjdgYnLg.js → prettier-plugin-oxfmt-Besh6ER1.js} +37 -3
- package/dist/{resolve-pWjAK-4f-BnquIxPb.js → sorter-BZkvDMjt-r7M4pM9t.js} +325 -4
- package/dist/{sorter-l2HyESZg.js → sorter-D0Nd4qpi.js} +1 -2
- package/dist/{v3-D-mr2VVh-Bw8A9MXh.js → v3-D-mr2VVh-DBBWnwM8.js} +3 -4
- package/dist/{v4-C-HWEQJm-B81QD_Ac.js → v4-C-HWEQJm-OZwT-Lc8.js} +3 -4
- package/package.json +20 -20
- package/dist/chunk-DSjvVL_1-B3jw0SMn.js +0 -36
- package/dist/sorter-BZkvDMjt-y2u_e1ZW.js +0 -212
- package/dist/utils-D8dQkKEd-Dgy5UIHl.js +0 -81
- /package/dist/{acorn-ay2Aj6GQ.js → acorn-Cz3eAoi8.js} +0 -0
- /package/dist/{angular-z1ZEe5V_.js → angular-BzDc3wVg.js} +0 -0
- /package/dist/{estree-DZBnPYMx.js → estree-BL2Xy2uB.js} +0 -0
- /package/dist/{flow-ChhAFZSt.js → flow-Bj4lBR-Y.js} +0 -0
- /package/dist/{glimmer-Cg8KQipT.js → glimmer-C2ccnwyy.js} +0 -0
- /package/dist/{graphql-DsP-ifm0.js → graphql-D73FSqwO.js} +0 -0
- /package/dist/{html-7pWx9LND.js → html-ENhiK7MR.js} +0 -0
- /package/dist/{markdown-CCrs3bBt.js → markdown-CDTH7TpJ.js} +0 -0
- /package/dist/{meriyah-TC7VDz8E.js → meriyah-C-N-xeFc.js} +0 -0
- /package/dist/{postcss-ZbUej7DN.js → postcss-CS83Slco.js} +0 -0
- /package/dist/{typescript-Cgpjcksz.js → typescript-DkgFgfZO.js} +0 -0
- /package/dist/{yaml-DLZBHI7f.js → yaml-Ddi9JTUZ.js} +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as createJiti } from "./jiti-Bb1dT6Cw-DezGRPD7.js";
|
|
1
|
+
import { _ as __esmMin, b as __toESM, g as __commonJSMin, s as bigSign, y as __require } from "./sorter-BZkvDMjt-r7M4pM9t.js";
|
|
2
|
+
import { t as createJiti } from "./jiti-Bb1dT6Cw-BtDs_aWX.js";
|
|
4
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
4
|
import * as path from "node:path";
|
|
6
|
-
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.3997fbd_prettier-plugin-svelte@3.5.
|
|
5
|
+
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.3997fbd_prettier-plugin-svelte@3.5.2_prettie_a08864e9b63fbbe60e61e20100abcb82/node_modules/prettier-plugin-tailwindcss/dist/v3-D-mr2VVh.mjs
|
|
7
6
|
var getFilename, __filename;
|
|
8
7
|
var init_esm_shims = __esmMin((() => {
|
|
9
8
|
getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as createJiti } from "./jiti-Bb1dT6Cw-DezGRPD7.js";
|
|
1
|
+
import { h as resolveJsFrom, m as resolveCssFrom, v as __exportAll } from "./sorter-BZkvDMjt-r7M4pM9t.js";
|
|
2
|
+
import { t as createJiti } from "./jiti-Bb1dT6Cw-BtDs_aWX.js";
|
|
4
3
|
import { pathToFileURL } from "node:url";
|
|
5
4
|
import * as path from "node:path";
|
|
6
5
|
import * as fs from "node:fs/promises";
|
|
7
|
-
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.3997fbd_prettier-plugin-svelte@3.5.
|
|
6
|
+
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.3997fbd_prettier-plugin-svelte@3.5.2_prettie_a08864e9b63fbbe60e61e20100abcb82/node_modules/prettier-plugin-tailwindcss/dist/v4-C-HWEQJm.mjs
|
|
8
7
|
var l$1 = {
|
|
9
8
|
inherit: "inherit",
|
|
10
9
|
current: "currentcolor",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxfmt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "Formatter for the JavaScript Oxidation Compiler",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"formatter",
|
|
@@ -82,24 +82,24 @@
|
|
|
82
82
|
},
|
|
83
83
|
"preferUnplugged": true,
|
|
84
84
|
"optionalDependencies": {
|
|
85
|
-
"@oxfmt/binding-darwin-arm64": "0.
|
|
86
|
-
"@oxfmt/binding-android-arm64": "0.
|
|
87
|
-
"@oxfmt/binding-win32-arm64-msvc": "0.
|
|
88
|
-
"@oxfmt/binding-linux-arm64-gnu": "0.
|
|
89
|
-
"@oxfmt/binding-linux-arm64-musl": "0.
|
|
90
|
-
"@oxfmt/binding-openharmony-arm64": "0.
|
|
91
|
-
"@oxfmt/binding-android-arm-eabi": "0.
|
|
92
|
-
"@oxfmt/binding-linux-arm-gnueabihf": "0.
|
|
93
|
-
"@oxfmt/binding-linux-arm-musleabihf": "0.
|
|
94
|
-
"@oxfmt/binding-win32-ia32-msvc": "0.
|
|
95
|
-
"@oxfmt/binding-linux-ppc64-gnu": "0.
|
|
96
|
-
"@oxfmt/binding-linux-riscv64-gnu": "0.
|
|
97
|
-
"@oxfmt/binding-linux-riscv64-musl": "0.
|
|
98
|
-
"@oxfmt/binding-linux-s390x-gnu": "0.
|
|
99
|
-
"@oxfmt/binding-darwin-x64": "0.
|
|
100
|
-
"@oxfmt/binding-win32-x64-msvc": "0.
|
|
101
|
-
"@oxfmt/binding-freebsd-x64": "0.
|
|
102
|
-
"@oxfmt/binding-linux-x64-gnu": "0.
|
|
103
|
-
"@oxfmt/binding-linux-x64-musl": "0.
|
|
85
|
+
"@oxfmt/binding-darwin-arm64": "0.51.0",
|
|
86
|
+
"@oxfmt/binding-android-arm64": "0.51.0",
|
|
87
|
+
"@oxfmt/binding-win32-arm64-msvc": "0.51.0",
|
|
88
|
+
"@oxfmt/binding-linux-arm64-gnu": "0.51.0",
|
|
89
|
+
"@oxfmt/binding-linux-arm64-musl": "0.51.0",
|
|
90
|
+
"@oxfmt/binding-openharmony-arm64": "0.51.0",
|
|
91
|
+
"@oxfmt/binding-android-arm-eabi": "0.51.0",
|
|
92
|
+
"@oxfmt/binding-linux-arm-gnueabihf": "0.51.0",
|
|
93
|
+
"@oxfmt/binding-linux-arm-musleabihf": "0.51.0",
|
|
94
|
+
"@oxfmt/binding-win32-ia32-msvc": "0.51.0",
|
|
95
|
+
"@oxfmt/binding-linux-ppc64-gnu": "0.51.0",
|
|
96
|
+
"@oxfmt/binding-linux-riscv64-gnu": "0.51.0",
|
|
97
|
+
"@oxfmt/binding-linux-riscv64-musl": "0.51.0",
|
|
98
|
+
"@oxfmt/binding-linux-s390x-gnu": "0.51.0",
|
|
99
|
+
"@oxfmt/binding-darwin-x64": "0.51.0",
|
|
100
|
+
"@oxfmt/binding-win32-x64-msvc": "0.51.0",
|
|
101
|
+
"@oxfmt/binding-freebsd-x64": "0.51.0",
|
|
102
|
+
"@oxfmt/binding-linux-x64-gnu": "0.51.0",
|
|
103
|
+
"@oxfmt/binding-linux-x64-musl": "0.51.0"
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.3997fbd_prettier-plugin-svelte@3.5.1_prettie_57f1f908c644a91a29f5821c3681dd20/node_modules/prettier-plugin-tailwindcss/dist/chunk-DSjvVL_1.mjs
|
|
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), mod.exports);
|
|
11
|
-
var __exportAll = (all, symbols) => {
|
|
12
|
-
let target = {};
|
|
13
|
-
for (var name in all) __defProp(target, name, {
|
|
14
|
-
get: all[name],
|
|
15
|
-
enumerable: true
|
|
16
|
-
});
|
|
17
|
-
if (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 __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
35
|
-
//#endregion
|
|
36
|
-
export { __toESM as a, __require as i, __esmMin as n, __exportAll as r, __commonJSMin as t };
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { a as resolveJsFrom, t as expiringMap } from "./resolve-pWjAK-4f-BnquIxPb.js";
|
|
2
|
-
import { n as cacheForDirs, t as bigSign } from "./utils-D8dQkKEd-Dgy5UIHl.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-plugin-svelte@3.5.1_prettie_57f1f908c644a91a29f5821c3681dd20/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-Bw8A9MXh.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-Bw8A9MXh.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-B81QD_Ac.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 };
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import * as path from "node:path";
|
|
2
|
-
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.3997fbd_prettier-plugin-svelte@3.5.1_prettie_57f1f908c644a91a29f5821c3681dd20/node_modules/prettier-plugin-tailwindcss/dist/utils-D8dQkKEd.mjs
|
|
3
|
-
function isNodeLike(value) {
|
|
4
|
-
return typeof (value === null || value === void 0 ? void 0 : value.type) === "string";
|
|
5
|
-
}
|
|
6
|
-
function visit(ast, callbackMap) {
|
|
7
|
-
function _visit(node, path, meta) {
|
|
8
|
-
if (typeof callbackMap === "function") {
|
|
9
|
-
if (callbackMap(node, path, meta) === false) return;
|
|
10
|
-
} else if (node.type in callbackMap) {
|
|
11
|
-
if (callbackMap[node.type](node, path, meta) === false) return;
|
|
12
|
-
}
|
|
13
|
-
const keys = Object.keys(node);
|
|
14
|
-
for (let i = 0; i < keys.length; i++) {
|
|
15
|
-
const child = node[keys[i]];
|
|
16
|
-
if (Array.isArray(child)) {
|
|
17
|
-
for (let j = 0; j < child.length; j++) if (isNodeLike(child[j])) {
|
|
18
|
-
let newMeta = { ...meta };
|
|
19
|
-
let newPath = [{
|
|
20
|
-
node: child[j],
|
|
21
|
-
parent: node,
|
|
22
|
-
key: keys[i],
|
|
23
|
-
index: j,
|
|
24
|
-
meta: newMeta
|
|
25
|
-
}, ...path];
|
|
26
|
-
_visit(child[j], newPath, newMeta);
|
|
27
|
-
}
|
|
28
|
-
} else if (isNodeLike(child)) {
|
|
29
|
-
let newMeta = { ...meta };
|
|
30
|
-
_visit(child, [{
|
|
31
|
-
node: child,
|
|
32
|
-
parent: node,
|
|
33
|
-
key: keys[i],
|
|
34
|
-
index: i,
|
|
35
|
-
meta: newMeta
|
|
36
|
-
}, ...path], newMeta);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
let newMeta = {};
|
|
41
|
-
_visit(ast, [{
|
|
42
|
-
node: ast,
|
|
43
|
-
parent: null,
|
|
44
|
-
key: null,
|
|
45
|
-
index: null,
|
|
46
|
-
meta: newMeta
|
|
47
|
-
}], newMeta);
|
|
48
|
-
}
|
|
49
|
-
function spliceChangesIntoString(str, changes) {
|
|
50
|
-
if (!changes[0]) return str;
|
|
51
|
-
changes.sort((a, b) => {
|
|
52
|
-
return a.end - b.end || a.start - b.start;
|
|
53
|
-
});
|
|
54
|
-
let result = "";
|
|
55
|
-
let previous = changes[0];
|
|
56
|
-
result += str.slice(0, previous.start);
|
|
57
|
-
result += previous.after;
|
|
58
|
-
for (let i = 1; i < changes.length; ++i) {
|
|
59
|
-
let change = changes[i];
|
|
60
|
-
result += str.slice(previous.end, change.start);
|
|
61
|
-
result += change.after;
|
|
62
|
-
previous = change;
|
|
63
|
-
}
|
|
64
|
-
result += str.slice(previous.end);
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
function bigSign(bigIntValue) {
|
|
68
|
-
return Number(bigIntValue > 0n) - Number(bigIntValue < 0n);
|
|
69
|
-
}
|
|
70
|
-
function cacheForDirs(cache, inputDir, value, targetDir, makeKey = (dir) => dir) {
|
|
71
|
-
let dir = inputDir;
|
|
72
|
-
while (dir !== path.dirname(dir) && dir.length >= targetDir.length) {
|
|
73
|
-
const key = makeKey(dir);
|
|
74
|
-
if (cache.get(key) !== void 0) break;
|
|
75
|
-
cache.set(key, value);
|
|
76
|
-
if (dir === targetDir) break;
|
|
77
|
-
dir = path.dirname(dir);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
|
-
export { visit as i, cacheForDirs as n, spliceChangesIntoString as r, bigSign as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|