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,7 +1,7 @@
|
|
|
1
1
|
import { a as __toCommonJS, i as __require, t as __commonJSMin } from "./chunk-HkwdBwDg.js";
|
|
2
2
|
import { n as init_babel, t as babel_exports } from "./babel-Cs312VeV.js";
|
|
3
|
-
import { n as prettier_exports, t as init_prettier } from "./prettier-
|
|
4
|
-
//#region ../../node_modules/.pnpm/prettier-plugin-svelte@3.5.
|
|
3
|
+
import { n as prettier_exports, t as init_prettier } from "./prettier-D7Ly-aG0.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/prettier-plugin-svelte@3.5.2_prettier@3.8.3_svelte@5.55.7_@typescript-eslint+types@8.59.3_/node_modules/prettier-plugin-svelte/plugin.js
|
|
5
5
|
var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
var prettierPluginBabel = (init_babel(), __toCommonJS(babel_exports));
|
|
@@ -386,9 +386,35 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
386
386
|
}
|
|
387
387
|
/**
|
|
388
388
|
* `(foo = bar)` => `foo = bar`
|
|
389
|
+
* Also handles leading comments and line breaks before "(".
|
|
389
390
|
*/
|
|
390
391
|
function removeParentheses(doc) {
|
|
391
|
-
return trim([doc], (_doc) => _doc === "(" || _doc === ")")[0];
|
|
392
|
+
if (!Array.isArray(doc)) return trim([doc], (_doc) => _doc === "(" || _doc === ")")[0];
|
|
393
|
+
const transformed = [];
|
|
394
|
+
let i = 0;
|
|
395
|
+
let opened = false;
|
|
396
|
+
for (; i < doc.length; i++) {
|
|
397
|
+
const part = doc[i];
|
|
398
|
+
if (typeof part === "string" && part.startsWith("//")) transformed.push(part);
|
|
399
|
+
else if (typeof part === "string" && part.startsWith("/*")) {
|
|
400
|
+
transformed.push(part);
|
|
401
|
+
opened = true;
|
|
402
|
+
} else if (opened) {
|
|
403
|
+
transformed.push(part);
|
|
404
|
+
opened = typeof part !== "string" || !part.trim().endsWith("*/");
|
|
405
|
+
} else if (transformed.length > 0 && isLine(part)) {
|
|
406
|
+
transformed.push(part);
|
|
407
|
+
i++;
|
|
408
|
+
const next = doc[i];
|
|
409
|
+
if (typeof next !== "string" && !Array.isArray(next) && next.type === "break-parent") {
|
|
410
|
+
transformed.push(next);
|
|
411
|
+
i++;
|
|
412
|
+
}
|
|
413
|
+
break;
|
|
414
|
+
} else break;
|
|
415
|
+
}
|
|
416
|
+
transformed.push(...trim(doc.slice(i), (_doc) => _doc === "(" || _doc === ")"));
|
|
417
|
+
return transformed;
|
|
392
418
|
}
|
|
393
419
|
const unsupportedLanguages = [
|
|
394
420
|
"coffee",
|
|
@@ -397,6 +423,18 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
397
423
|
"stylus",
|
|
398
424
|
"sass"
|
|
399
425
|
];
|
|
426
|
+
/**
|
|
427
|
+
* Characters treated as interchangeable/collapsible HTML whitespace for layout.
|
|
428
|
+
* Excludes NBSP (U+00A0) and other Unicode separators — see prettier/prettier#5796.
|
|
429
|
+
*/
|
|
430
|
+
const ONLY_HTML_COLLAPSE_WHITESPACE_RE = /^[\t\n\f\r ]*$/;
|
|
431
|
+
const STARTS_WITH_HTML_COLLAPSE_WHITESPACE_RE = /^[\t\n\f\r ]/;
|
|
432
|
+
const ENDS_WITH_HTML_COLLAPSE_WHITESPACE_RE = /[\t\n\f\r ]$/;
|
|
433
|
+
const LEADING_HTML_COLLAPSE_WHITESPACE_RE = /^[\t\n\f\r ]+/;
|
|
434
|
+
const TRAILING_HTML_COLLAPSE_WHITESPACE_RE = /[\t\n\f\r ]+$/;
|
|
435
|
+
function isOnlyHtmlCollapseWhitespace(text) {
|
|
436
|
+
return ONLY_HTML_COLLAPSE_WHITESPACE_RE.test(text);
|
|
437
|
+
}
|
|
400
438
|
function isInlineElement(path, options, node) {
|
|
401
439
|
return node && node.type === "Element" && !isBlockElement(node, options) && !isPreTagContent(path);
|
|
402
440
|
}
|
|
@@ -472,7 +510,7 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
472
510
|
return !!root.html && !!root.html.children && root.html.children.includes(node);
|
|
473
511
|
}
|
|
474
512
|
function isEmptyTextNode(node) {
|
|
475
|
-
return !!node && node.type === "Text" && getUnencodedText(node)
|
|
513
|
+
return !!node && node.type === "Text" && isOnlyHtmlCollapseWhitespace(getUnencodedText(node));
|
|
476
514
|
}
|
|
477
515
|
function isIgnoreDirective(node) {
|
|
478
516
|
return !!node && node.type === "Comment" && node.data.trim() === "prettier-ignore";
|
|
@@ -584,18 +622,18 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
584
622
|
return new RegExp(`(\\n[\\t\\f\\r ]*){${nrLines}}$`).test(text);
|
|
585
623
|
}
|
|
586
624
|
function isTextNodeStartingWithWhitespace(node) {
|
|
587
|
-
return node.type === "Text" &&
|
|
625
|
+
return node.type === "Text" && STARTS_WITH_HTML_COLLAPSE_WHITESPACE_RE.test(getUnencodedText(node));
|
|
588
626
|
}
|
|
589
627
|
function isTextNodeEndingWithWhitespace(node) {
|
|
590
|
-
return node.type === "Text" &&
|
|
628
|
+
return node.type === "Text" && ENDS_WITH_HTML_COLLAPSE_WHITESPACE_RE.test(getUnencodedText(node));
|
|
591
629
|
}
|
|
592
630
|
function trimTextNodeRight(node) {
|
|
593
|
-
node.raw = node.raw && node.raw.
|
|
594
|
-
node.data = node.data && node.data.
|
|
631
|
+
node.raw = node.raw && node.raw.replace(TRAILING_HTML_COLLAPSE_WHITESPACE_RE, "");
|
|
632
|
+
node.data = node.data && node.data.replace(TRAILING_HTML_COLLAPSE_WHITESPACE_RE, "");
|
|
595
633
|
}
|
|
596
634
|
function trimTextNodeLeft(node) {
|
|
597
|
-
node.raw = node.raw && node.raw.
|
|
598
|
-
node.data = node.data && node.data.
|
|
635
|
+
node.raw = node.raw && node.raw.replace(LEADING_HTML_COLLAPSE_WHITESPACE_RE, "");
|
|
636
|
+
node.data = node.data && node.data.replace(LEADING_HTML_COLLAPSE_WHITESPACE_RE, "");
|
|
599
637
|
}
|
|
600
638
|
/**
|
|
601
639
|
* Remove all leading whitespace up until the first non-empty text node,
|
|
@@ -660,7 +698,7 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
660
698
|
const parentOpeningEnd = options.originalText.lastIndexOf("}", firstChild.start);
|
|
661
699
|
if (parentOpeningEnd > 0 && firstChild.start > parentOpeningEnd + 1) {
|
|
662
700
|
const textBetween = options.originalText.substring(parentOpeningEnd + 1, firstChild.start);
|
|
663
|
-
if (
|
|
701
|
+
if (ONLY_HTML_COLLAPSE_WHITESPACE_RE.test(textBetween)) return startsWithLinebreak(textBetween) ? "line" : "space";
|
|
664
702
|
}
|
|
665
703
|
return "none";
|
|
666
704
|
}
|
|
@@ -677,7 +715,7 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
677
715
|
const parentClosingStart = options.originalText.indexOf("{", lastChild.end);
|
|
678
716
|
if (parentClosingStart > 0 && lastChild.end < parentClosingStart) {
|
|
679
717
|
const textBetween = options.originalText.substring(lastChild.end, parentClosingStart);
|
|
680
|
-
if (
|
|
718
|
+
if (ONLY_HTML_COLLAPSE_WHITESPACE_RE.test(textBetween)) return endsWithLinebreak(textBetween) ? "line" : "space";
|
|
681
719
|
}
|
|
682
720
|
return "none";
|
|
683
721
|
}
|
|
@@ -696,7 +734,7 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
696
734
|
*/
|
|
697
735
|
function hugsStartOfNextNode(node, options) {
|
|
698
736
|
if (node.end === options.originalText.length) return false;
|
|
699
|
-
return !options.originalText.substring(node.end)
|
|
737
|
+
return !STARTS_WITH_HTML_COLLAPSE_WHITESPACE_RE.test(options.originalText.substring(node.end));
|
|
700
738
|
}
|
|
701
739
|
function isLastChildWithinParentBlockElement(path, options) {
|
|
702
740
|
const parent = path.getParentNode();
|
|
@@ -772,15 +810,16 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
772
810
|
if (children.length === 0 || children.every(isEmptyTextNode)) return "";
|
|
773
811
|
if (!isPreTagContent(path)) {
|
|
774
812
|
trimChildren(node.children, path);
|
|
775
|
-
const output = trim([printChildren(path, print, options)], (n) => isLine(n) || typeof n === "string" && n
|
|
813
|
+
const output = trim([printChildren(path, print, options)], (n) => isLine(n) || typeof n === "string" && isOnlyHtmlCollapseWhitespace(n) || n === breakParent);
|
|
776
814
|
if (output.every((doc) => isEmptyDoc(doc))) return "";
|
|
777
815
|
return group([...output, hardline]);
|
|
778
816
|
} else return group(path.map(print, "children"));
|
|
779
817
|
case "Text": if (!isPreTagContent(path)) {
|
|
780
818
|
if (isEmptyTextNode(node)) {
|
|
781
|
-
const
|
|
782
|
-
const
|
|
783
|
-
|
|
819
|
+
const text = getUnencodedText(node);
|
|
820
|
+
const hasWhiteSpace = text.length > 0;
|
|
821
|
+
const hasOneOrMoreNewlines = /\n/.test(text);
|
|
822
|
+
if (/\n\r?[\t\n\f\r ]*\n\r?/.test(text)) return [hardline, hardline];
|
|
784
823
|
if (hasOneOrMoreNewlines) return hardline;
|
|
785
824
|
if (hasWhiteSpace) return line;
|
|
786
825
|
return "";
|
|
@@ -1438,24 +1477,29 @@ var require_plugin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1438
1477
|
return path.call(print, name);
|
|
1439
1478
|
}
|
|
1440
1479
|
function expandNode(node, original) {
|
|
1441
|
-
let str = _expandNode(node);
|
|
1480
|
+
let str = _expandNode(node, original);
|
|
1442
1481
|
if (node === null || node === void 0 ? void 0 : node.typeAnnotation) str += ": " + original.slice(node.typeAnnotation.typeAnnotation.start, node.typeAnnotation.typeAnnotation.end);
|
|
1443
1482
|
return str;
|
|
1444
1483
|
}
|
|
1445
|
-
function _expandNode(node, parent) {
|
|
1484
|
+
function _expandNode(node, original, parent) {
|
|
1485
|
+
var _a, _b;
|
|
1446
1486
|
if (node === null) return "";
|
|
1447
1487
|
if (typeof node === "string") return " " + node;
|
|
1448
1488
|
switch (node.type) {
|
|
1449
1489
|
case "ArrayExpression":
|
|
1450
|
-
case "ArrayPattern": return " [" + node.elements.map((el) => el === null ? " " : _expandNode(el)).join(",").slice(1) + "]";
|
|
1451
|
-
case "AssignmentPattern": return _expandNode(node.left) + " =" + _expandNode(node.right);
|
|
1490
|
+
case "ArrayPattern": return " [" + node.elements.map((el) => el === null ? " " : _expandNode(el, original)).join(",").slice(1) + "]";
|
|
1491
|
+
case "AssignmentPattern": return _expandNode(node.left, original) + " =" + _expandNode(node.right, original);
|
|
1452
1492
|
case "Identifier": return " " + node.name;
|
|
1453
1493
|
case "Literal": return " " + node.raw;
|
|
1454
|
-
case "ObjectExpression": return " {" + node.properties.map((p) => _expandNode(p, node)).join(",") + " }";
|
|
1455
|
-
case "ObjectPattern": return " {" + node.properties.map(_expandNode).join(",") + " }";
|
|
1456
|
-
case "Property":
|
|
1457
|
-
|
|
1458
|
-
|
|
1494
|
+
case "ObjectExpression": return " {" + node.properties.map((p) => _expandNode(p, original, node)).join(",") + " }";
|
|
1495
|
+
case "ObjectPattern": return " {" + node.properties.map((p) => _expandNode(p, original)).join(",") + " }";
|
|
1496
|
+
case "Property": {
|
|
1497
|
+
let computedKeyInner = "";
|
|
1498
|
+
if (node.computed) computedKeyInner = typeof ((_a = node.key) === null || _a === void 0 ? void 0 : _a.start) === "number" && typeof ((_b = node.key) === null || _b === void 0 ? void 0 : _b.end) === "number" ? original.slice(node.key.start, node.key.end) : _expandNode(node.key, original).trim();
|
|
1499
|
+
if (node.value.type === "ObjectPattern" || node.value.type === "ArrayPattern") return (node.computed ? " [" + computedKeyInner + "]" : " " + node.key.name) + ":" + _expandNode(node.value, original);
|
|
1500
|
+
else if (node.value.type === "Identifier" && node.key.name !== node.value.name || parent && parent.type === "ObjectExpression") return (node.computed ? " [" + computedKeyInner + "]" : _expandNode(node.key, original)) + ":" + _expandNode(node.value, original);
|
|
1501
|
+
else return _expandNode(node.value, original);
|
|
1502
|
+
}
|
|
1459
1503
|
case "RestElement": return " ..." + node.argument.name;
|
|
1460
1504
|
}
|
|
1461
1505
|
console.error(JSON.stringify(node, null, 4));
|
|
@@ -2402,7 +2402,7 @@ async function loadConfigFromPackageYaml(file) {
|
|
|
2402
2402
|
}
|
|
2403
2403
|
async function loadYaml(file) {
|
|
2404
2404
|
const content = await read_file_default(file);
|
|
2405
|
-
if (!parseYaml) ({__parsePrettierYamlConfig: parseYaml} = await import("./yaml-
|
|
2405
|
+
if (!parseYaml) ({__parsePrettierYamlConfig: parseYaml} = await import("./yaml-Ddi9JTUZ.js"));
|
|
2406
2406
|
try {
|
|
2407
2407
|
return parseYaml(content);
|
|
2408
2408
|
} catch (error) {
|
|
@@ -15380,7 +15380,7 @@ ${codeblock}`, options8);
|
|
|
15380
15380
|
proseWrap: common_options_evaluate_default.proseWrap
|
|
15381
15381
|
};
|
|
15382
15382
|
estreePlugin = createParsersAndPrinters([{
|
|
15383
|
-
importPlugin: () => import("./estree-
|
|
15383
|
+
importPlugin: () => import("./estree-BL2Xy2uB.js"),
|
|
15384
15384
|
printers: ["estree", "estree-json"]
|
|
15385
15385
|
}]);
|
|
15386
15386
|
options7 = {
|
|
@@ -15403,11 +15403,11 @@ ${codeblock}`, options8);
|
|
|
15403
15403
|
];
|
|
15404
15404
|
({parsers, printers} = createParsersAndPrinters([
|
|
15405
15405
|
{
|
|
15406
|
-
importPlugin: () => import("./acorn-
|
|
15406
|
+
importPlugin: () => import("./acorn-Cz3eAoi8.js"),
|
|
15407
15407
|
parsers: ["acorn", "espree"]
|
|
15408
15408
|
},
|
|
15409
15409
|
{
|
|
15410
|
-
importPlugin: () => import("./angular-
|
|
15410
|
+
importPlugin: () => import("./angular-BzDc3wVg.js"),
|
|
15411
15411
|
parsers: [
|
|
15412
15412
|
"__ng_action",
|
|
15413
15413
|
"__ng_binding",
|
|
@@ -15435,21 +15435,21 @@ ${codeblock}`, options8);
|
|
|
15435
15435
|
]
|
|
15436
15436
|
},
|
|
15437
15437
|
{
|
|
15438
|
-
importPlugin: () => import("./flow-
|
|
15438
|
+
importPlugin: () => import("./flow-Bj4lBR-Y.js"),
|
|
15439
15439
|
parsers: ["flow"]
|
|
15440
15440
|
},
|
|
15441
15441
|
{
|
|
15442
|
-
importPlugin: () => import("./glimmer-
|
|
15442
|
+
importPlugin: () => import("./glimmer-C2ccnwyy.js"),
|
|
15443
15443
|
parsers: ["glimmer"],
|
|
15444
15444
|
printers: ["glimmer"]
|
|
15445
15445
|
},
|
|
15446
15446
|
{
|
|
15447
|
-
importPlugin: () => import("./graphql-
|
|
15447
|
+
importPlugin: () => import("./graphql-D73FSqwO.js"),
|
|
15448
15448
|
parsers: ["graphql"],
|
|
15449
15449
|
printers: ["graphql"]
|
|
15450
15450
|
},
|
|
15451
15451
|
{
|
|
15452
|
-
importPlugin: () => import("./html-
|
|
15452
|
+
importPlugin: () => import("./html-ENhiK7MR.js"),
|
|
15453
15453
|
parsers: [
|
|
15454
15454
|
"html",
|
|
15455
15455
|
"angular",
|
|
@@ -15460,7 +15460,7 @@ ${codeblock}`, options8);
|
|
|
15460
15460
|
printers: ["html"]
|
|
15461
15461
|
},
|
|
15462
15462
|
{
|
|
15463
|
-
importPlugin: () => import("./markdown-
|
|
15463
|
+
importPlugin: () => import("./markdown-CDTH7TpJ.js"),
|
|
15464
15464
|
parsers: [
|
|
15465
15465
|
"markdown",
|
|
15466
15466
|
"mdx",
|
|
@@ -15469,11 +15469,11 @@ ${codeblock}`, options8);
|
|
|
15469
15469
|
printers: ["mdast"]
|
|
15470
15470
|
},
|
|
15471
15471
|
{
|
|
15472
|
-
importPlugin: () => import("./meriyah-
|
|
15472
|
+
importPlugin: () => import("./meriyah-C-N-xeFc.js"),
|
|
15473
15473
|
parsers: ["meriyah"]
|
|
15474
15474
|
},
|
|
15475
15475
|
{
|
|
15476
|
-
importPlugin: () => import("./postcss-
|
|
15476
|
+
importPlugin: () => import("./postcss-CS83Slco.js"),
|
|
15477
15477
|
parsers: [
|
|
15478
15478
|
"css",
|
|
15479
15479
|
"less",
|
|
@@ -15482,11 +15482,11 @@ ${codeblock}`, options8);
|
|
|
15482
15482
|
printers: ["postcss"]
|
|
15483
15483
|
},
|
|
15484
15484
|
{
|
|
15485
|
-
importPlugin: () => import("./typescript-
|
|
15485
|
+
importPlugin: () => import("./typescript-DkgFgfZO.js"),
|
|
15486
15486
|
parsers: ["typescript"]
|
|
15487
15487
|
},
|
|
15488
15488
|
{
|
|
15489
|
-
importPlugin: () => import("./yaml-
|
|
15489
|
+
importPlugin: () => import("./yaml-Ddi9JTUZ.js"),
|
|
15490
15490
|
parsers: ["yaml"],
|
|
15491
15491
|
printers: ["yaml"]
|
|
15492
15492
|
}
|
|
@@ -2,11 +2,45 @@ import { jsTextToDoc } from "./index.js";
|
|
|
2
2
|
//#region src-js/libs/prettier-plugin-oxfmt/text-to-doc.ts
|
|
3
3
|
const textToDoc = async (embeddedSourceText, textToDocOptions) => {
|
|
4
4
|
const { parser, parentParser, filepath, _oxfmtPluginOptionsJson } = textToDocOptions;
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
|
|
5
|
+
const docJSON = await jsTextToDoc(parser === "typescript" || parser === "babel-ts" ? filepath?.endsWith(".tsx") ? "tsx" : "ts" : "jsx", embeddedSourceText, _oxfmtPluginOptionsJson, detectParentContext(parentParser, textToDocOptions));
|
|
6
|
+
if (docJSON === null) throw new Error("`oxfmt::textToDoc()` failed. Use `OXC_LOG` env var to see Rust-side logs.");
|
|
7
|
+
const { doc, refs } = JSON.parse(docJSON);
|
|
8
|
+
if (refs.length === 0) return doc;
|
|
9
|
+
return resolveRefs(doc, refs, Array.from({ length: refs.length }));
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
12
|
+
* Rust emits `Interned` sub-trees once into `refs` and references them via `{ _REF: <id> }` placeholders,
|
|
13
|
+
* preventing exponential JSON blowup when the same sub-tree is duplicated variants.
|
|
14
|
+
*
|
|
15
|
+
* Restore shared object references so Prettier sees the original (memory-shared) structure.
|
|
16
|
+
* Identity does not affect output because Prettier identifies groups by their `id` field,
|
|
17
|
+
* not by JS object identity.
|
|
18
|
+
*
|
|
19
|
+
* The `_REF` key (uppercase, prefixed) is chosen to never collide with valid Prettier Doc node keys,
|
|
20
|
+
* so the `typeof obj._REF === "number"` check uniquely identifies placeholders.
|
|
21
|
+
*
|
|
22
|
+
* Refs are resolved on-demand with memoization.
|
|
23
|
+
* A ref `i` may reference any other ref `j` (including `j < i`) because Rust caches `Interned` by pointer
|
|
24
|
+
* and an earlier-encountered `Interned` (smaller id) can also appear inside a later one's content.
|
|
25
|
+
* Topological / reverse-order resolution would observe `undefined` holes, so we recurse lazily.
|
|
26
|
+
*/
|
|
27
|
+
function resolveRefs(node, rawRefs, cache) {
|
|
28
|
+
if (node === null || typeof node !== "object") return node;
|
|
29
|
+
if (Array.isArray(node)) return node.map((n) => resolveRefs(n, rawRefs, cache));
|
|
30
|
+
const obj = node;
|
|
31
|
+
if (typeof obj._REF === "number") {
|
|
32
|
+
const id = obj._REF;
|
|
33
|
+
const cached = cache[id];
|
|
34
|
+
if (cached !== void 0) return cached;
|
|
35
|
+
const resolved = resolveRefs(rawRefs[id], rawRefs, cache);
|
|
36
|
+
cache[id] = resolved;
|
|
37
|
+
return resolved;
|
|
38
|
+
}
|
|
39
|
+
const out = {};
|
|
40
|
+
for (const k in obj) out[k] = resolveRefs(obj[k], rawRefs, cache);
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
10
44
|
* Detects Vue fragment mode from Prettier's internal flags.
|
|
11
45
|
*
|
|
12
46
|
* When Prettier formats Vue SFC templates, it calls textToDoc with special flags:
|
|
@@ -1,7 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { dirname, resolve } from "path";
|
|
5
|
+
import { readdirSync, statSync } from "fs";
|
|
3
6
|
import fs from "node:fs";
|
|
4
|
-
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.3997fbd_prettier-plugin-svelte@3.5.
|
|
7
|
+
//#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/chunk-DSjvVL_1.mjs
|
|
8
|
+
var __create = Object.create;
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
15
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
16
|
+
var __exportAll = (all, symbols) => {
|
|
17
|
+
let target = {};
|
|
18
|
+
for (var name in all) __defProp(target, name, {
|
|
19
|
+
get: all[name],
|
|
20
|
+
enumerable: true
|
|
21
|
+
});
|
|
22
|
+
if (symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
23
|
+
return target;
|
|
24
|
+
};
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
27
|
+
key = keys[i];
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
29
|
+
get: ((k) => from[k]).bind(null, key),
|
|
30
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
36
|
+
value: mod,
|
|
37
|
+
enumerable: true
|
|
38
|
+
}) : target, mod));
|
|
39
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
40
|
+
//#endregion
|
|
41
|
+
//#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/resolve-pWjAK-4f.mjs
|
|
5
42
|
function expiringMap(duration) {
|
|
6
43
|
let map = /* @__PURE__ */ new Map();
|
|
7
44
|
return {
|
|
@@ -4195,4 +4232,288 @@ function resolveCssFrom(base, id) {
|
|
|
4195
4232
|
return cssResolver.resolveSync({}, base, id) || id;
|
|
4196
4233
|
}
|
|
4197
4234
|
//#endregion
|
|
4198
|
-
|
|
4235
|
+
//#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/utils-D8dQkKEd.mjs
|
|
4236
|
+
function isNodeLike(value) {
|
|
4237
|
+
return typeof (value === null || value === void 0 ? void 0 : value.type) === "string";
|
|
4238
|
+
}
|
|
4239
|
+
function visit(ast, callbackMap) {
|
|
4240
|
+
function _visit(node, path, meta) {
|
|
4241
|
+
if (typeof callbackMap === "function") {
|
|
4242
|
+
if (callbackMap(node, path, meta) === false) return;
|
|
4243
|
+
} else if (node.type in callbackMap) {
|
|
4244
|
+
if (callbackMap[node.type](node, path, meta) === false) return;
|
|
4245
|
+
}
|
|
4246
|
+
const keys = Object.keys(node);
|
|
4247
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4248
|
+
const child = node[keys[i]];
|
|
4249
|
+
if (Array.isArray(child)) {
|
|
4250
|
+
for (let j = 0; j < child.length; j++) if (isNodeLike(child[j])) {
|
|
4251
|
+
let newMeta = { ...meta };
|
|
4252
|
+
let newPath = [{
|
|
4253
|
+
node: child[j],
|
|
4254
|
+
parent: node,
|
|
4255
|
+
key: keys[i],
|
|
4256
|
+
index: j,
|
|
4257
|
+
meta: newMeta
|
|
4258
|
+
}, ...path];
|
|
4259
|
+
_visit(child[j], newPath, newMeta);
|
|
4260
|
+
}
|
|
4261
|
+
} else if (isNodeLike(child)) {
|
|
4262
|
+
let newMeta = { ...meta };
|
|
4263
|
+
_visit(child, [{
|
|
4264
|
+
node: child,
|
|
4265
|
+
parent: node,
|
|
4266
|
+
key: keys[i],
|
|
4267
|
+
index: i,
|
|
4268
|
+
meta: newMeta
|
|
4269
|
+
}, ...path], newMeta);
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4272
|
+
}
|
|
4273
|
+
let newMeta = {};
|
|
4274
|
+
_visit(ast, [{
|
|
4275
|
+
node: ast,
|
|
4276
|
+
parent: null,
|
|
4277
|
+
key: null,
|
|
4278
|
+
index: null,
|
|
4279
|
+
meta: newMeta
|
|
4280
|
+
}], newMeta);
|
|
4281
|
+
}
|
|
4282
|
+
function spliceChangesIntoString(str, changes) {
|
|
4283
|
+
if (!changes[0]) return str;
|
|
4284
|
+
changes.sort((a, b) => {
|
|
4285
|
+
return a.end - b.end || a.start - b.start;
|
|
4286
|
+
});
|
|
4287
|
+
let result = "";
|
|
4288
|
+
let previous = changes[0];
|
|
4289
|
+
result += str.slice(0, previous.start);
|
|
4290
|
+
result += previous.after;
|
|
4291
|
+
for (let i = 1; i < changes.length; ++i) {
|
|
4292
|
+
let change = changes[i];
|
|
4293
|
+
result += str.slice(previous.end, change.start);
|
|
4294
|
+
result += change.after;
|
|
4295
|
+
previous = change;
|
|
4296
|
+
}
|
|
4297
|
+
result += str.slice(previous.end);
|
|
4298
|
+
return result;
|
|
4299
|
+
}
|
|
4300
|
+
function bigSign(bigIntValue) {
|
|
4301
|
+
return Number(bigIntValue > 0n) - Number(bigIntValue < 0n);
|
|
4302
|
+
}
|
|
4303
|
+
function cacheForDirs(cache, inputDir, value, targetDir, makeKey = (dir) => dir) {
|
|
4304
|
+
let dir = inputDir;
|
|
4305
|
+
while (dir !== path.dirname(dir) && dir.length >= targetDir.length) {
|
|
4306
|
+
const key = makeKey(dir);
|
|
4307
|
+
if (cache.get(key) !== void 0) break;
|
|
4308
|
+
cache.set(key, value);
|
|
4309
|
+
if (dir === targetDir) break;
|
|
4310
|
+
dir = path.dirname(dir);
|
|
4311
|
+
}
|
|
4312
|
+
}
|
|
4313
|
+
//#endregion
|
|
4314
|
+
//#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/sorter-BZkvDMjt.mjs
|
|
4315
|
+
let seen = /* @__PURE__ */ new Set();
|
|
4316
|
+
function warn(key, arg, ...args) {
|
|
4317
|
+
if (seen.has(key)) return;
|
|
4318
|
+
seen.add(key);
|
|
4319
|
+
console.warn(arg, ...args);
|
|
4320
|
+
}
|
|
4321
|
+
function error(key, arg, ...args) {
|
|
4322
|
+
if (seen.has(key)) return;
|
|
4323
|
+
seen.add(key);
|
|
4324
|
+
console.error(arg, ...args);
|
|
4325
|
+
}
|
|
4326
|
+
function sync_default(start, callback) {
|
|
4327
|
+
let dir = resolve(".", start);
|
|
4328
|
+
let tmp;
|
|
4329
|
+
if (!statSync(dir).isDirectory()) dir = dirname(dir);
|
|
4330
|
+
while (true) {
|
|
4331
|
+
tmp = callback(dir, readdirSync(dir));
|
|
4332
|
+
if (tmp) return resolve(dir, tmp);
|
|
4333
|
+
dir = dirname(tmp = dir);
|
|
4334
|
+
if (tmp === dir) break;
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
function sortClasses(classStr, { env, ignoreFirst = false, ignoreLast = false, removeDuplicates = true, collapseWhitespace = {
|
|
4338
|
+
start: true,
|
|
4339
|
+
end: true
|
|
4340
|
+
} }) {
|
|
4341
|
+
if (typeof classStr !== "string" || classStr === "") return classStr;
|
|
4342
|
+
if (classStr.includes("{{")) return classStr;
|
|
4343
|
+
if (env.options.tailwindPreserveWhitespace) collapseWhitespace = false;
|
|
4344
|
+
if (env.options.tailwindPreserveDuplicates) removeDuplicates = false;
|
|
4345
|
+
if (collapseWhitespace && /^[\t\r\f\n ]+$/.test(classStr)) return " ";
|
|
4346
|
+
let result = "";
|
|
4347
|
+
let parts = classStr.split(/([\t\r\f\n ]+)/);
|
|
4348
|
+
let classes = parts.filter((_, i) => i % 2 === 0);
|
|
4349
|
+
let whitespace = parts.filter((_, i) => i % 2 !== 0);
|
|
4350
|
+
if (classes[classes.length - 1] === "") classes.pop();
|
|
4351
|
+
if (collapseWhitespace) whitespace = whitespace.map(() => " ");
|
|
4352
|
+
let prefix = "";
|
|
4353
|
+
if (ignoreFirst) prefix = `${classes.shift() ?? ""}${whitespace.shift() ?? ""}`;
|
|
4354
|
+
let suffix = "";
|
|
4355
|
+
if (ignoreLast) suffix = `${whitespace.pop() ?? ""}${classes.pop() ?? ""}`;
|
|
4356
|
+
let { classList, removedIndices } = sortClassList({
|
|
4357
|
+
classList: classes,
|
|
4358
|
+
api: env.context,
|
|
4359
|
+
removeDuplicates
|
|
4360
|
+
});
|
|
4361
|
+
whitespace = whitespace.filter((_, index) => !removedIndices.has(index + 1));
|
|
4362
|
+
for (let i = 0; i < classList.length; i++) result += `${classList[i]}${whitespace[i] ?? ""}`;
|
|
4363
|
+
if (collapseWhitespace) {
|
|
4364
|
+
prefix = prefix.replace(/\s+$/g, " ");
|
|
4365
|
+
suffix = suffix.replace(/^\s+/g, " ");
|
|
4366
|
+
result = result.replace(/^\s+/, collapseWhitespace.start ? "" : " ").replace(/\s+$/, collapseWhitespace.end ? "" : " ");
|
|
4367
|
+
}
|
|
4368
|
+
return prefix + result + suffix;
|
|
4369
|
+
}
|
|
4370
|
+
function sortClassList({ classList, api, removeDuplicates }) {
|
|
4371
|
+
let orderedClasses = api.getClassOrder(classList);
|
|
4372
|
+
orderedClasses.sort(([nameA, a], [nameZ, z]) => {
|
|
4373
|
+
if (nameA === "..." || nameA === "…") return 1;
|
|
4374
|
+
if (nameZ === "..." || nameZ === "…") return -1;
|
|
4375
|
+
if (a === z) return 0;
|
|
4376
|
+
if (a === null) return -1;
|
|
4377
|
+
if (z === null) return 1;
|
|
4378
|
+
return bigSign(a - z);
|
|
4379
|
+
});
|
|
4380
|
+
let removedIndices = /* @__PURE__ */ new Set();
|
|
4381
|
+
if (removeDuplicates) {
|
|
4382
|
+
let seenClasses = /* @__PURE__ */ new Set();
|
|
4383
|
+
orderedClasses = orderedClasses.filter(([cls, order], index) => {
|
|
4384
|
+
if (seenClasses.has(cls)) {
|
|
4385
|
+
removedIndices.add(index);
|
|
4386
|
+
return false;
|
|
4387
|
+
}
|
|
4388
|
+
if (order !== null) seenClasses.add(cls);
|
|
4389
|
+
return true;
|
|
4390
|
+
});
|
|
4391
|
+
}
|
|
4392
|
+
return {
|
|
4393
|
+
classList: orderedClasses.map(([className]) => className),
|
|
4394
|
+
removedIndices
|
|
4395
|
+
};
|
|
4396
|
+
}
|
|
4397
|
+
function resolveIfRelative(base, filePath) {
|
|
4398
|
+
if (!filePath) return null;
|
|
4399
|
+
return path.isAbsolute(filePath) ? filePath : path.resolve(base, filePath);
|
|
4400
|
+
}
|
|
4401
|
+
let pathToApiMap = expiringMap(1e4);
|
|
4402
|
+
async function getTailwindConfig(options) {
|
|
4403
|
+
let base = options.base ?? process.cwd();
|
|
4404
|
+
let inputDir = options.filepath ? path.dirname(options.filepath) : base;
|
|
4405
|
+
let configPath = resolveIfRelative(base, options.configPath);
|
|
4406
|
+
let stylesheetPath = resolveIfRelative(base, options.stylesheetPath);
|
|
4407
|
+
let [mod, pkgDir] = await resolveTailwindPath({ packageName: options.packageName }, inputDir);
|
|
4408
|
+
let stylesheet = resolveStylesheet(stylesheetPath, base);
|
|
4409
|
+
let jsConfig = resolveJsConfigPath(configPath);
|
|
4410
|
+
if (!stylesheet && !(mod === null || mod === void 0 ? void 0 : mod.__unstable__loadDesignSystem)) jsConfig = jsConfig ?? findClosestJsConfig(inputDir);
|
|
4411
|
+
if (jsConfig) {
|
|
4412
|
+
if (!stylesheet) return pathToApiMap.remember(`${pkgDir}:${jsConfig}`, async () => {
|
|
4413
|
+
const { loadV3 } = await import("./v3-D-mr2VVh-DBBWnwM8.js");
|
|
4414
|
+
return loadV3(pkgDir, jsConfig);
|
|
4415
|
+
});
|
|
4416
|
+
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.`);
|
|
4417
|
+
}
|
|
4418
|
+
if (mod && !mod.__unstable__loadDesignSystem) {
|
|
4419
|
+
if (!stylesheet) return pathToApiMap.remember(`${pkgDir}:${jsConfig}`, async () => {
|
|
4420
|
+
const { loadV3 } = await import("./v3-D-mr2VVh-DBBWnwM8.js");
|
|
4421
|
+
return loadV3(pkgDir, jsConfig);
|
|
4422
|
+
});
|
|
4423
|
+
mod = null;
|
|
4424
|
+
error("stylesheet-unsupported", base, "You have specified a Tailwind CSS stylesheet but your installed version of Tailwind CSS does not support this feature.");
|
|
4425
|
+
}
|
|
4426
|
+
if (mod && mod.__unstable__loadDesignSystem && pkgDir) stylesheet ?? (stylesheet = `${pkgDir}/theme.css`);
|
|
4427
|
+
return pathToApiMap.remember(`${pkgDir}:${stylesheet}`, async () => {
|
|
4428
|
+
const { loadV4 } = await import("./v4-C-HWEQJm-OZwT-Lc8.js");
|
|
4429
|
+
return loadV4(mod, stylesheet);
|
|
4430
|
+
});
|
|
4431
|
+
}
|
|
4432
|
+
let resolvedModCache = expiringMap(1e4);
|
|
4433
|
+
async function resolveTailwindPath(options, baseDir) {
|
|
4434
|
+
let pkgName = options.packageName ?? "tailwindcss";
|
|
4435
|
+
let makeKey = (dir) => `${pkgName}:${dir}`;
|
|
4436
|
+
let cached = resolvedModCache.get(makeKey(baseDir));
|
|
4437
|
+
if (cached !== void 0) return cached;
|
|
4438
|
+
let resolve = async () => {
|
|
4439
|
+
let pkgDir = null;
|
|
4440
|
+
let mod = null;
|
|
4441
|
+
try {
|
|
4442
|
+
mod = await import(pathToFileURL(resolveJsFrom(baseDir, pkgName)).toString());
|
|
4443
|
+
let pkgFile = resolveJsFrom(baseDir, `${pkgName}/package.json`);
|
|
4444
|
+
pkgDir = path.dirname(pkgFile);
|
|
4445
|
+
} catch {}
|
|
4446
|
+
return [mod, pkgDir];
|
|
4447
|
+
};
|
|
4448
|
+
let result = await resolve();
|
|
4449
|
+
let [, pkgDir] = result;
|
|
4450
|
+
if (pkgDir) cacheForDirs(resolvedModCache, baseDir, result, pkgDir, makeKey);
|
|
4451
|
+
else resolvedModCache.set(makeKey(baseDir), result);
|
|
4452
|
+
return result;
|
|
4453
|
+
}
|
|
4454
|
+
function resolveJsConfigPath(configPath) {
|
|
4455
|
+
if (!configPath) return null;
|
|
4456
|
+
if (configPath.endsWith(".css")) return null;
|
|
4457
|
+
return configPath;
|
|
4458
|
+
}
|
|
4459
|
+
let configPathCache = /* @__PURE__ */ new Map();
|
|
4460
|
+
function findClosestJsConfig(inputDir) {
|
|
4461
|
+
let cached = configPathCache.get(inputDir);
|
|
4462
|
+
if (cached !== void 0) return cached;
|
|
4463
|
+
let configPath = null;
|
|
4464
|
+
try {
|
|
4465
|
+
configPath = sync_default(inputDir, (_, names) => {
|
|
4466
|
+
if (names.includes("tailwind.config.js")) return "tailwind.config.js";
|
|
4467
|
+
if (names.includes("tailwind.config.cjs")) return "tailwind.config.cjs";
|
|
4468
|
+
if (names.includes("tailwind.config.mjs")) return "tailwind.config.mjs";
|
|
4469
|
+
if (names.includes("tailwind.config.ts")) return "tailwind.config.ts";
|
|
4470
|
+
}) ?? null;
|
|
4471
|
+
} catch {}
|
|
4472
|
+
if (configPath) cacheForDirs(configPathCache, inputDir, configPath, path.dirname(configPath));
|
|
4473
|
+
else configPathCache.set(inputDir, null);
|
|
4474
|
+
return configPath;
|
|
4475
|
+
}
|
|
4476
|
+
function resolveStylesheet(stylesheetPath, base) {
|
|
4477
|
+
if (!stylesheetPath) return null;
|
|
4478
|
+
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.");
|
|
4479
|
+
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.");
|
|
4480
|
+
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.");
|
|
4481
|
+
return stylesheetPath;
|
|
4482
|
+
}
|
|
4483
|
+
async function createSorter(opts) {
|
|
4484
|
+
let preserveDuplicates = opts.preserveDuplicates ?? false;
|
|
4485
|
+
let preserveWhitespace = opts.preserveWhitespace ?? false;
|
|
4486
|
+
let api = await getTailwindConfig({
|
|
4487
|
+
base: opts.base,
|
|
4488
|
+
filepath: opts.filepath,
|
|
4489
|
+
configPath: opts.configPath,
|
|
4490
|
+
stylesheetPath: opts.stylesheetPath,
|
|
4491
|
+
packageName: opts.packageName
|
|
4492
|
+
});
|
|
4493
|
+
let env = {
|
|
4494
|
+
context: api,
|
|
4495
|
+
changes: [],
|
|
4496
|
+
options: {
|
|
4497
|
+
tailwindPreserveWhitespace: preserveWhitespace,
|
|
4498
|
+
tailwindPreserveDuplicates: preserveDuplicates,
|
|
4499
|
+
tailwindPackageName: opts.packageName
|
|
4500
|
+
},
|
|
4501
|
+
matcher: void 0
|
|
4502
|
+
};
|
|
4503
|
+
return {
|
|
4504
|
+
sortClassLists(classes) {
|
|
4505
|
+
return classes.map((list) => {
|
|
4506
|
+
return sortClassList({
|
|
4507
|
+
api,
|
|
4508
|
+
classList: list,
|
|
4509
|
+
removeDuplicates: !preserveDuplicates
|
|
4510
|
+
}).classList;
|
|
4511
|
+
});
|
|
4512
|
+
},
|
|
4513
|
+
sortClassAttributes(classes) {
|
|
4514
|
+
return classes.map((list) => sortClasses(list, { env }));
|
|
4515
|
+
}
|
|
4516
|
+
};
|
|
4517
|
+
}
|
|
4518
|
+
//#endregion
|
|
4519
|
+
export { __esmMin as _, sortClasses as a, __toESM as b, cacheForDirs as c, expiringMap as d, loadIfExists as f, __commonJSMin as g, resolveJsFrom as h, sortClassList as i, spliceChangesIntoString as l, resolveCssFrom as m, error as n, warn as o, maybeResolve as p, getTailwindConfig as r, bigSign as s, createSorter as t, visit as u, __exportAll as v, __require as y };
|