oxfmt 0.51.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.
- package/dist/{acorn-Cz3eAoi8.js → acorn-C-l7ouWN.js} +1 -1
- package/dist/{angular-BzDc3wVg.js → angular-4Mc0TmPv.js} +3 -5
- package/dist/{apis-H4bwlBNm.js → apis-Cc9jzUH4.js} +6 -6
- package/dist/{babel-Cs312VeV.js → babel-DjR61Wf3.js} +2 -3
- package/dist/{bindings-qpSSlUMn.js → bindings-BJw0GhQr.js} +26 -26
- package/dist/cli-worker.js +1 -1
- package/dist/cli.js +44 -25
- package/dist/{dist-DieWQ1D0.js → dist-CJyFMFm2.js} +70 -50
- package/dist/{estree-BL2Xy2uB.js → estree-DHQPBKqf.js} +1 -1
- package/dist/{flow-Bj4lBR-Y.js → flow-Cz3mJAtC.js} +1 -1
- package/dist/{glimmer-C2ccnwyy.js → glimmer-ubhL-0tG.js} +1 -1
- package/dist/{graphql-D73FSqwO.js → graphql-Cl0TIiHU.js} +1 -1
- package/dist/{html-ENhiK7MR.js → html-Cqnv8X__.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-BbKOMZ57.js → init-DGfXRYLw.js} +1 -1
- package/dist/{jiti-Bb1dT6Cw-BtDs_aWX.js → jiti-Bb1dT6Cw-B_5IaZk7.js} +2 -2
- package/dist/{markdown-CDTH7TpJ.js → markdown-Eujfu-fQ.js} +1 -1
- package/dist/{meriyah-C-N-xeFc.js → meriyah-DESRG6oe.js} +1 -1
- package/dist/{migrate-biome-BMqs7-eg.js → migrate-biome-P928W9-y.js} +1 -1
- package/dist/{migrate-prettier-CBzqnxHw.js → migrate-prettier-CotsZUFl.js} +2 -2
- package/dist/{plugin-DiRKvkOT.js → plugin-C4twtOn4.js} +433 -374
- package/dist/{postcss-CS83Slco.js → postcss-BFLfznNY.js} +1 -1
- package/dist/{prettier-D7Ly-aG0.js → prettier-Cy-lZk4k.js} +15 -15
- package/dist/{sorter-BZkvDMjt-r7M4pM9t.js → sorter-BZkvDMjt-C3eOnP5z.js} +7 -7
- package/dist/{sorter-D0Nd4qpi.js → sorter-CHFUGfz-.js} +1 -1
- package/dist/{typescript-DkgFgfZO.js → typescript-lqJOqGcK.js} +1 -1
- package/dist/{v3-D-mr2VVh-DBBWnwM8.js → v3-D-mr2VVh-BXhnMySQ.js} +3 -3
- package/dist/{v4-C-HWEQJm-OZwT-Lc8.js → v4-C-HWEQJm-CvgekpKf.js} +3 -3
- package/dist/{yaml-Ddi9JTUZ.js → yaml-D3PpfZBy.js} +1 -1
- package/package.json +25 -21
- /package/dist/{chunk-HkwdBwDg.js → chunk-CNf5ZN-e.js} +0 -0
- /package/dist/{prettier-plugin-oxfmt-Besh6ER1.js → prettier-plugin-oxfmt-Dj6FaAil.js} +0 -0
- /package/dist/{shared-BTEY2VsW.js → shared-BiMl-bLP.js} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { o as __toESM } from "./chunk-
|
|
2
|
-
import { n as init_babel, parsers as ra, t as babel_exports } from "./babel-
|
|
3
|
-
import index_exports, { t as init_prettier } from "./prettier-
|
|
4
|
-
import { a as sortClasses, b as __toESM$1, c as cacheForDirs, d as expiringMap, f as loadIfExists, g as __commonJSMin, i as sortClassList, l as spliceChangesIntoString, n as error, o as warn, p as maybeResolve, r as getTailwindConfig$1, u as visit } from "./sorter-BZkvDMjt-
|
|
5
|
-
import { parsers as fn, t as init_angular } from "./angular-
|
|
6
|
-
import { n as postcss_exports, parsers as en, t as init_postcss } from "./postcss-
|
|
1
|
+
import { o as __toESM } from "./chunk-CNf5ZN-e.js";
|
|
2
|
+
import { n as init_babel, parsers as ra, t as babel_exports } from "./babel-DjR61Wf3.js";
|
|
3
|
+
import index_exports, { t as init_prettier } from "./prettier-Cy-lZk4k.js";
|
|
4
|
+
import { a as sortClasses, b as __toESM$1, c as cacheForDirs, d as expiringMap, f as loadIfExists, g as __commonJSMin, i as sortClassList, l as spliceChangesIntoString, n as error, o as warn, p as maybeResolve, r as getTailwindConfig$1, u as visit } from "./sorter-BZkvDMjt-C3eOnP5z.js";
|
|
5
|
+
import { parsers as fn, t as init_angular } from "./angular-4Mc0TmPv.js";
|
|
6
|
+
import { n as postcss_exports, parsers as en, t as init_postcss } from "./postcss-BFLfznNY.js";
|
|
7
7
|
import * as path from "node:path";
|
|
8
8
|
import { isAbsolute } from "path";
|
|
9
|
-
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.
|
|
9
|
+
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.2b6f3c2_prettier-plugin-svelte@4.0.1_prettie_b20d8b14d002a94b1de20f5a14f79b1e/node_modules/prettier-plugin-tailwindcss/dist/index.mjs
|
|
10
10
|
init_angular();
|
|
11
11
|
init_babel();
|
|
12
12
|
init_postcss();
|
|
@@ -417,7 +417,6 @@ function transformAst({ ast, env, opts }) {
|
|
|
417
417
|
function defineTransform(opts) {
|
|
418
418
|
return opts;
|
|
419
419
|
}
|
|
420
|
-
const ESCAPE_SEQUENCE_PATTERN = /\\(['"\\nrtbfv0-7xuU])/g;
|
|
421
420
|
function tryParseAngularAttribute(value, env) {
|
|
422
421
|
try {
|
|
423
422
|
return fn.__ng_directive.parse(value, env.options);
|
|
@@ -678,26 +677,29 @@ function sortStringLiteral(node, { env, removeDuplicates, collapseWhitespace = {
|
|
|
678
677
|
start: true,
|
|
679
678
|
end: true
|
|
680
679
|
} }) {
|
|
681
|
-
var _node$extra3
|
|
682
|
-
let
|
|
680
|
+
var _node$extra3;
|
|
681
|
+
let raw = ((_node$extra3 = node.extra) === null || _node$extra3 === void 0 ? void 0 : _node$extra3.raw) ?? node.raw;
|
|
682
|
+
let quote = raw[0];
|
|
683
|
+
let rawContent = raw.slice(1, -1);
|
|
684
|
+
let sortedRaw = sortClasses(rawContent, {
|
|
683
685
|
env,
|
|
684
686
|
removeDuplicates,
|
|
685
687
|
collapseWhitespace
|
|
686
688
|
});
|
|
687
|
-
if (
|
|
688
|
-
node.value
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
689
|
+
if (sortedRaw === rawContent) return false;
|
|
690
|
+
let sortedCooked = rawContent === node.value ? sortedRaw : sortClasses(node.value, {
|
|
691
|
+
env,
|
|
692
|
+
removeDuplicates,
|
|
693
|
+
collapseWhitespace
|
|
694
|
+
});
|
|
695
|
+
node.value = sortedCooked;
|
|
696
|
+
let newRaw = quote + sortedRaw + quote;
|
|
697
|
+
if (node.extra) node.extra = {
|
|
698
|
+
...node.extra,
|
|
699
|
+
rawValue: sortedCooked,
|
|
700
|
+
raw: newRaw
|
|
701
|
+
};
|
|
702
|
+
else node.raw = newRaw;
|
|
701
703
|
return true;
|
|
702
704
|
}
|
|
703
705
|
function isStringLiteral(node) {
|
|
@@ -979,25 +981,26 @@ function transformSvelte(ast, env) {
|
|
|
979
981
|
let { matcher, changes } = env;
|
|
980
982
|
for (let attr of ast.attributes ?? []) {
|
|
981
983
|
if (!matcher.hasStaticAttr(attr.name) || attr.type !== "Attribute") continue;
|
|
982
|
-
|
|
983
|
-
|
|
984
|
+
let values = getSvelteAttributeValues(attr);
|
|
985
|
+
for (let i = 0; i < values.length; i++) {
|
|
986
|
+
let value = values[i];
|
|
984
987
|
if (value.type === "Text") {
|
|
985
988
|
let same = value.raw === value.data;
|
|
986
989
|
value.raw = sortClasses(value.raw, {
|
|
987
990
|
env,
|
|
988
991
|
ignoreFirst: i > 0 && !/^\s/.test(value.raw),
|
|
989
|
-
ignoreLast: i <
|
|
992
|
+
ignoreLast: i < values.length - 1 && !/\s$/.test(value.raw),
|
|
990
993
|
removeDuplicates: true,
|
|
991
994
|
collapseWhitespace: false
|
|
992
995
|
});
|
|
993
996
|
value.data = same ? value.raw : sortClasses(value.data, {
|
|
994
997
|
env,
|
|
995
998
|
ignoreFirst: i > 0 && !/^\s/.test(value.data),
|
|
996
|
-
ignoreLast: i <
|
|
999
|
+
ignoreLast: i < values.length - 1 && !/\s$/.test(value.data),
|
|
997
1000
|
removeDuplicates: true,
|
|
998
1001
|
collapseWhitespace: false
|
|
999
1002
|
});
|
|
1000
|
-
} else if (value.type === "MustacheTag") visit(value.expression, {
|
|
1003
|
+
} else if (value.type === "MustacheTag" || value.type === "ExpressionTag") visit(value.expression, {
|
|
1001
1004
|
Literal(node) {
|
|
1002
1005
|
if (isStringLiteral(node)) {
|
|
1003
1006
|
let before = node.raw;
|
|
@@ -1029,27 +1032,44 @@ function transformSvelte(ast, env) {
|
|
|
1029
1032
|
});
|
|
1030
1033
|
}
|
|
1031
1034
|
}
|
|
1032
|
-
for (let child of ast
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1035
|
+
for (let child of getSvelteChildNodes(ast)) transformSvelte(child, env);
|
|
1036
|
+
}
|
|
1037
|
+
function getSvelteAttributeValues(attr) {
|
|
1038
|
+
if (Array.isArray(attr.value)) return attr.value;
|
|
1039
|
+
if (attr.value && typeof attr.value === "object") return [attr.value];
|
|
1040
|
+
return [];
|
|
1041
|
+
}
|
|
1042
|
+
function getSvelteChildNodes(node) {
|
|
1043
|
+
let children = [];
|
|
1044
|
+
for (let key of [
|
|
1045
|
+
"children",
|
|
1046
|
+
"nodes",
|
|
1047
|
+
"fragment",
|
|
1048
|
+
"html",
|
|
1049
|
+
"else",
|
|
1050
|
+
"consequent",
|
|
1051
|
+
"alternate",
|
|
1052
|
+
"body",
|
|
1053
|
+
"fallback",
|
|
1054
|
+
"pending",
|
|
1055
|
+
"then",
|
|
1056
|
+
"catch"
|
|
1057
|
+
]) children.push(...getSvelteNodes(node[key]));
|
|
1058
|
+
return children;
|
|
1059
|
+
}
|
|
1060
|
+
function getSvelteNodes(value) {
|
|
1061
|
+
if (Array.isArray(value)) return value.filter((node) => node === null || node === void 0 ? void 0 : node.type);
|
|
1062
|
+
if (Array.isArray(value === null || value === void 0 ? void 0 : value.nodes)) return value.nodes;
|
|
1063
|
+
if (Array.isArray(value === null || value === void 0 ? void 0 : value.children)) return value.children;
|
|
1064
|
+
if (value === null || value === void 0 ? void 0 : value.type) return [value];
|
|
1065
|
+
return [];
|
|
1046
1066
|
}
|
|
1047
1067
|
const { parsers, printers } = createPlugin([
|
|
1048
1068
|
defineTransform({
|
|
1049
1069
|
staticAttrs: ["class"],
|
|
1050
1070
|
load: [{
|
|
1051
1071
|
name: "prettier/plugins/html",
|
|
1052
|
-
importer: () => import("./html-
|
|
1072
|
+
importer: () => import("./html-Cqnv8X__.js")
|
|
1053
1073
|
}],
|
|
1054
1074
|
compatible: ["prettier-plugin-organize-attributes"],
|
|
1055
1075
|
parsers: {
|
|
@@ -1064,7 +1084,7 @@ const { parsers, printers } = createPlugin([
|
|
|
1064
1084
|
staticAttrs: ["class"],
|
|
1065
1085
|
load: [{
|
|
1066
1086
|
name: "prettier/plugins/glimmer",
|
|
1067
|
-
importer: () => import("./glimmer-
|
|
1087
|
+
importer: () => import("./glimmer-ubhL-0tG.js")
|
|
1068
1088
|
}],
|
|
1069
1089
|
parsers: { glimmer: {} },
|
|
1070
1090
|
transform: transformGlimmer
|
|
@@ -1096,19 +1116,19 @@ const { parsers, printers } = createPlugin([
|
|
|
1096
1116
|
__js_expression: { load: [babel_exports] },
|
|
1097
1117
|
typescript: { load: [{
|
|
1098
1118
|
name: "prettier/plugins/typescript",
|
|
1099
|
-
importer: () => import("./typescript-
|
|
1119
|
+
importer: () => import("./typescript-lqJOqGcK.js")
|
|
1100
1120
|
}] },
|
|
1101
1121
|
meriyah: { load: [{
|
|
1102
1122
|
name: "prettier/plugins/meriyah",
|
|
1103
|
-
importer: () => import("./meriyah-
|
|
1123
|
+
importer: () => import("./meriyah-DESRG6oe.js")
|
|
1104
1124
|
}] },
|
|
1105
1125
|
acorn: { load: [{
|
|
1106
1126
|
name: "prettier/plugins/acorn",
|
|
1107
|
-
importer: () => import("./acorn-
|
|
1127
|
+
importer: () => import("./acorn-C-l7ouWN.js")
|
|
1108
1128
|
}] },
|
|
1109
1129
|
flow: { load: [{
|
|
1110
1130
|
name: "prettier/plugins/flow",
|
|
1111
|
-
importer: () => import("./flow-
|
|
1131
|
+
importer: () => import("./flow-Cz3mJAtC.js")
|
|
1112
1132
|
}] },
|
|
1113
1133
|
oxc: { load: [{
|
|
1114
1134
|
name: "@prettier/plugin-oxc",
|
|
@@ -1139,7 +1159,7 @@ const { parsers, printers } = createPlugin([
|
|
|
1139
1159
|
staticAttrs: ["class"],
|
|
1140
1160
|
load: [{
|
|
1141
1161
|
name: "prettier-plugin-svelte",
|
|
1142
|
-
importer: () => import("./plugin-
|
|
1162
|
+
importer: () => import("./plugin-C4twtOn4.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1))
|
|
1143
1163
|
}],
|
|
1144
1164
|
parsers: { svelte: {} },
|
|
1145
1165
|
printers: { "svelte-ast": {} },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __esmMin } from "./chunk-
|
|
1
|
+
import { n as __esmMin } from "./chunk-CNf5ZN-e.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/prettier@3.8.3/node_modules/prettier/plugins/flow.mjs
|
|
3
3
|
function iI0(a0, ox) {
|
|
4
4
|
let Yx = /* @__PURE__ */ new SyntaxError(a0 + " (" + ox.loc.start.line + ":" + ox.loc.start.column + ")");
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as jsTextToDoc$1, t as format$1 } from "./bindings-
|
|
2
|
-
import { i as sortTailwindClasses, n as formatEmbeddedDoc, r as formatFile, t as formatEmbeddedCode } from "./apis-
|
|
1
|
+
import { n as jsTextToDoc$1, t as format$1 } from "./bindings-BJw0GhQr.js";
|
|
2
|
+
import { i as sortTailwindClasses, n as formatEmbeddedDoc, r as formatFile, t as formatEmbeddedCode } from "./apis-Cc9jzUH4.js";
|
|
3
3
|
//#region src-js/index.ts
|
|
4
4
|
/**
|
|
5
5
|
* Define an oxfmt configuration with type inference.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as saveOxfmtrcFile, n as exitWithError, r as hasOxfmtrcFile, t as createBlankOxfmtrcFile } from "./shared-
|
|
1
|
+
import { i as saveOxfmtrcFile, n as exitWithError, r as hasOxfmtrcFile, t as createBlankOxfmtrcFile } from "./shared-BiMl-bLP.js";
|
|
2
2
|
//#region src-js/cli/migration/init.ts
|
|
3
3
|
/**
|
|
4
4
|
* Run the `--init` command to scaffold a default `.oxfmtrc.json` file.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as __toESM, g as __commonJSMin, y as __require } from "./sorter-BZkvDMjt-
|
|
1
|
+
import { b as __toESM, g as __commonJSMin, y as __require } from "./sorter-BZkvDMjt-C3eOnP5z.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.
|
|
3
|
+
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.2b6f3c2_prettier-plugin-svelte@4.0.1_prettie_b20d8b14d002a94b1de20f5a14f79b1e/node_modules/prettier-plugin-tailwindcss/dist/jiti-Bb1dT6Cw.mjs
|
|
4
4
|
var require_jiti = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
5
|
(() => {
|
|
6
6
|
var e = { "./node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist lazy recursive": function(e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as saveOxfmtrcFile, n as exitWithError, r as hasOxfmtrcFile, t as createBlankOxfmtrcFile } from "./shared-
|
|
1
|
+
import { i as saveOxfmtrcFile, n as exitWithError, r as hasOxfmtrcFile, t as createBlankOxfmtrcFile } from "./shared-BiMl-bLP.js";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
//#region src-js/cli/migration/migrate-biome.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as saveOxfmtrcFile, n as exitWithError, r as hasOxfmtrcFile, t as createBlankOxfmtrcFile } from "./shared-
|
|
1
|
+
import { i as saveOxfmtrcFile, n as exitWithError, r as hasOxfmtrcFile, t as createBlankOxfmtrcFile } from "./shared-BiMl-bLP.js";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
//#region src-js/cli/migration/migrate-prettier.ts
|
|
@@ -9,7 +9,7 @@ import { readFile } from "node:fs/promises";
|
|
|
9
9
|
async function runMigratePrettier() {
|
|
10
10
|
const cwd = process.cwd();
|
|
11
11
|
if (await hasOxfmtrcFile(cwd)) return exitWithError("Oxfmt configuration file already exists.");
|
|
12
|
-
const { resolveConfigFile, resolveConfig } = await import("./prettier-
|
|
12
|
+
const { resolveConfigFile, resolveConfig } = await import("./prettier-Cy-lZk4k.js");
|
|
13
13
|
const prettierConfigPath = await resolveConfigFile(join(cwd, "dummy.js"));
|
|
14
14
|
if (!prettierConfigPath) {
|
|
15
15
|
console.log("No Prettier configuration file found.");
|