oxfmt 0.51.0 → 0.53.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-DOCQy_NG.js} +6 -6
- package/dist/{babel-Cs312VeV.js → babel-DjR61Wf3.js} +2 -3
- package/dist/{bindings-qpSSlUMn.js → bindings-ChKdN0o7.js} +31 -30
- package/dist/chunk-DSjvVL_1-CrjveNIv.js +36 -0
- package/dist/cli-worker.js +1 -1
- package/dist/cli.js +44 -25
- package/dist/{dist-DieWQ1D0.js → dist-Cb-CB0nt.js} +71 -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.d.ts +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-bfahw2Ut.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-DWPaoKDl.js} +2 -2
- package/dist/{plugin-DiRKvkOT.js → plugin-DOvWpprN.js} +434 -375
- package/dist/{postcss-CS83Slco.js → postcss-BFLfznNY.js} +1 -1
- package/dist/{prettier-D7Ly-aG0.js → prettier-CttUn4xj.js} +15 -15
- package/dist/{sorter-BZkvDMjt-r7M4pM9t.js → sorter-BZkvDMjt-X7PZZf-k.js} +8 -42
- package/dist/{sorter-D0Nd4qpi.js → sorter-o4mwRTof.js} +1 -1
- package/dist/{typescript-DkgFgfZO.js → typescript-lqJOqGcK.js} +1 -1
- package/dist/{v3-D-mr2VVh-DBBWnwM8.js → v3-D-mr2VVh-BYLPgMY0.js} +4 -3
- package/dist/{v4-C-HWEQJm-OZwT-Lc8.js → v4-C-HWEQJm-DbK_mluY.js} +4 -3
- package/dist/{yaml-Ddi9JTUZ.js → yaml-BT3ntp8h.js} +3 -3
- 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,13 @@
|
|
|
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
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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-CttUn4xj.js";
|
|
4
|
+
import { a as __toESM$1, t as __commonJSMin } from "./chunk-DSjvVL_1-CrjveNIv.js";
|
|
5
|
+
import { a as sortClasses, c as cacheForDirs, d as expiringMap, f as loadIfExists, 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-X7PZZf-k.js";
|
|
6
|
+
import { parsers as fn, t as init_angular } from "./angular-4Mc0TmPv.js";
|
|
7
|
+
import { n as postcss_exports, parsers as en, t as init_postcss } from "./postcss-BFLfznNY.js";
|
|
7
8
|
import * as path from "node:path";
|
|
8
9
|
import { isAbsolute } from "path";
|
|
9
|
-
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.
|
|
10
|
+
//#region ../../node_modules/.pnpm/prettier-plugin-tailwindcss@0.0.0-insiders.2b6f3c2_prettier-plugin-svelte@4.0.1_prettie_961279539c8b58c29c93389b521be834/node_modules/prettier-plugin-tailwindcss/dist/index.mjs
|
|
10
11
|
init_angular();
|
|
11
12
|
init_babel();
|
|
12
13
|
init_postcss();
|
|
@@ -417,7 +418,6 @@ function transformAst({ ast, env, opts }) {
|
|
|
417
418
|
function defineTransform(opts) {
|
|
418
419
|
return opts;
|
|
419
420
|
}
|
|
420
|
-
const ESCAPE_SEQUENCE_PATTERN = /\\(['"\\nrtbfv0-7xuU])/g;
|
|
421
421
|
function tryParseAngularAttribute(value, env) {
|
|
422
422
|
try {
|
|
423
423
|
return fn.__ng_directive.parse(value, env.options);
|
|
@@ -678,26 +678,29 @@ function sortStringLiteral(node, { env, removeDuplicates, collapseWhitespace = {
|
|
|
678
678
|
start: true,
|
|
679
679
|
end: true
|
|
680
680
|
} }) {
|
|
681
|
-
var _node$extra3
|
|
682
|
-
let
|
|
681
|
+
var _node$extra3;
|
|
682
|
+
let raw = ((_node$extra3 = node.extra) === null || _node$extra3 === void 0 ? void 0 : _node$extra3.raw) ?? node.raw;
|
|
683
|
+
let quote = raw[0];
|
|
684
|
+
let rawContent = raw.slice(1, -1);
|
|
685
|
+
let sortedRaw = sortClasses(rawContent, {
|
|
683
686
|
env,
|
|
684
687
|
removeDuplicates,
|
|
685
688
|
collapseWhitespace
|
|
686
689
|
});
|
|
687
|
-
if (
|
|
688
|
-
node.value
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
690
|
+
if (sortedRaw === rawContent) return false;
|
|
691
|
+
let sortedCooked = rawContent === node.value ? sortedRaw : sortClasses(node.value, {
|
|
692
|
+
env,
|
|
693
|
+
removeDuplicates,
|
|
694
|
+
collapseWhitespace
|
|
695
|
+
});
|
|
696
|
+
node.value = sortedCooked;
|
|
697
|
+
let newRaw = quote + sortedRaw + quote;
|
|
698
|
+
if (node.extra) node.extra = {
|
|
699
|
+
...node.extra,
|
|
700
|
+
rawValue: sortedCooked,
|
|
701
|
+
raw: newRaw
|
|
702
|
+
};
|
|
703
|
+
else node.raw = newRaw;
|
|
701
704
|
return true;
|
|
702
705
|
}
|
|
703
706
|
function isStringLiteral(node) {
|
|
@@ -979,25 +982,26 @@ function transformSvelte(ast, env) {
|
|
|
979
982
|
let { matcher, changes } = env;
|
|
980
983
|
for (let attr of ast.attributes ?? []) {
|
|
981
984
|
if (!matcher.hasStaticAttr(attr.name) || attr.type !== "Attribute") continue;
|
|
982
|
-
|
|
983
|
-
|
|
985
|
+
let values = getSvelteAttributeValues(attr);
|
|
986
|
+
for (let i = 0; i < values.length; i++) {
|
|
987
|
+
let value = values[i];
|
|
984
988
|
if (value.type === "Text") {
|
|
985
989
|
let same = value.raw === value.data;
|
|
986
990
|
value.raw = sortClasses(value.raw, {
|
|
987
991
|
env,
|
|
988
992
|
ignoreFirst: i > 0 && !/^\s/.test(value.raw),
|
|
989
|
-
ignoreLast: i <
|
|
993
|
+
ignoreLast: i < values.length - 1 && !/\s$/.test(value.raw),
|
|
990
994
|
removeDuplicates: true,
|
|
991
995
|
collapseWhitespace: false
|
|
992
996
|
});
|
|
993
997
|
value.data = same ? value.raw : sortClasses(value.data, {
|
|
994
998
|
env,
|
|
995
999
|
ignoreFirst: i > 0 && !/^\s/.test(value.data),
|
|
996
|
-
ignoreLast: i <
|
|
1000
|
+
ignoreLast: i < values.length - 1 && !/\s$/.test(value.data),
|
|
997
1001
|
removeDuplicates: true,
|
|
998
1002
|
collapseWhitespace: false
|
|
999
1003
|
});
|
|
1000
|
-
} else if (value.type === "MustacheTag") visit(value.expression, {
|
|
1004
|
+
} else if (value.type === "MustacheTag" || value.type === "ExpressionTag") visit(value.expression, {
|
|
1001
1005
|
Literal(node) {
|
|
1002
1006
|
if (isStringLiteral(node)) {
|
|
1003
1007
|
let before = node.raw;
|
|
@@ -1029,27 +1033,44 @@ function transformSvelte(ast, env) {
|
|
|
1029
1033
|
});
|
|
1030
1034
|
}
|
|
1031
1035
|
}
|
|
1032
|
-
for (let child of ast
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1036
|
+
for (let child of getSvelteChildNodes(ast)) transformSvelte(child, env);
|
|
1037
|
+
}
|
|
1038
|
+
function getSvelteAttributeValues(attr) {
|
|
1039
|
+
if (Array.isArray(attr.value)) return attr.value;
|
|
1040
|
+
if (attr.value && typeof attr.value === "object") return [attr.value];
|
|
1041
|
+
return [];
|
|
1042
|
+
}
|
|
1043
|
+
function getSvelteChildNodes(node) {
|
|
1044
|
+
let children = [];
|
|
1045
|
+
for (let key of [
|
|
1046
|
+
"children",
|
|
1047
|
+
"nodes",
|
|
1048
|
+
"fragment",
|
|
1049
|
+
"html",
|
|
1050
|
+
"else",
|
|
1051
|
+
"consequent",
|
|
1052
|
+
"alternate",
|
|
1053
|
+
"body",
|
|
1054
|
+
"fallback",
|
|
1055
|
+
"pending",
|
|
1056
|
+
"then",
|
|
1057
|
+
"catch"
|
|
1058
|
+
]) children.push(...getSvelteNodes(node[key]));
|
|
1059
|
+
return children;
|
|
1060
|
+
}
|
|
1061
|
+
function getSvelteNodes(value) {
|
|
1062
|
+
if (Array.isArray(value)) return value.filter((node) => node === null || node === void 0 ? void 0 : node.type);
|
|
1063
|
+
if (Array.isArray(value === null || value === void 0 ? void 0 : value.nodes)) return value.nodes;
|
|
1064
|
+
if (Array.isArray(value === null || value === void 0 ? void 0 : value.children)) return value.children;
|
|
1065
|
+
if (value === null || value === void 0 ? void 0 : value.type) return [value];
|
|
1066
|
+
return [];
|
|
1046
1067
|
}
|
|
1047
1068
|
const { parsers, printers } = createPlugin([
|
|
1048
1069
|
defineTransform({
|
|
1049
1070
|
staticAttrs: ["class"],
|
|
1050
1071
|
load: [{
|
|
1051
1072
|
name: "prettier/plugins/html",
|
|
1052
|
-
importer: () => import("./html-
|
|
1073
|
+
importer: () => import("./html-Cqnv8X__.js")
|
|
1053
1074
|
}],
|
|
1054
1075
|
compatible: ["prettier-plugin-organize-attributes"],
|
|
1055
1076
|
parsers: {
|
|
@@ -1064,7 +1085,7 @@ const { parsers, printers } = createPlugin([
|
|
|
1064
1085
|
staticAttrs: ["class"],
|
|
1065
1086
|
load: [{
|
|
1066
1087
|
name: "prettier/plugins/glimmer",
|
|
1067
|
-
importer: () => import("./glimmer-
|
|
1088
|
+
importer: () => import("./glimmer-ubhL-0tG.js")
|
|
1068
1089
|
}],
|
|
1069
1090
|
parsers: { glimmer: {} },
|
|
1070
1091
|
transform: transformGlimmer
|
|
@@ -1096,19 +1117,19 @@ const { parsers, printers } = createPlugin([
|
|
|
1096
1117
|
__js_expression: { load: [babel_exports] },
|
|
1097
1118
|
typescript: { load: [{
|
|
1098
1119
|
name: "prettier/plugins/typescript",
|
|
1099
|
-
importer: () => import("./typescript-
|
|
1120
|
+
importer: () => import("./typescript-lqJOqGcK.js")
|
|
1100
1121
|
}] },
|
|
1101
1122
|
meriyah: { load: [{
|
|
1102
1123
|
name: "prettier/plugins/meriyah",
|
|
1103
|
-
importer: () => import("./meriyah-
|
|
1124
|
+
importer: () => import("./meriyah-DESRG6oe.js")
|
|
1104
1125
|
}] },
|
|
1105
1126
|
acorn: { load: [{
|
|
1106
1127
|
name: "prettier/plugins/acorn",
|
|
1107
|
-
importer: () => import("./acorn-
|
|
1128
|
+
importer: () => import("./acorn-C-l7ouWN.js")
|
|
1108
1129
|
}] },
|
|
1109
1130
|
flow: { load: [{
|
|
1110
1131
|
name: "prettier/plugins/flow",
|
|
1111
|
-
importer: () => import("./flow-
|
|
1132
|
+
importer: () => import("./flow-Cz3mJAtC.js")
|
|
1112
1133
|
}] },
|
|
1113
1134
|
oxc: { load: [{
|
|
1114
1135
|
name: "@prettier/plugin-oxc",
|
|
@@ -1139,7 +1160,7 @@ const { parsers, printers } = createPlugin([
|
|
|
1139
1160
|
staticAttrs: ["class"],
|
|
1140
1161
|
load: [{
|
|
1141
1162
|
name: "prettier-plugin-svelte",
|
|
1142
|
-
importer: () => import("./plugin-
|
|
1163
|
+
importer: () => import("./plugin-DOvWpprN.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1))
|
|
1143
1164
|
}],
|
|
1144
1165
|
parsers: { svelte: {} },
|
|
1145
1166
|
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.d.ts
CHANGED
|
@@ -842,4 +842,4 @@ declare function format(fileName: string, sourceText: string, options?: FormatCo
|
|
|
842
842
|
*/
|
|
843
843
|
declare function jsTextToDoc(sourceExt: string, sourceText: string, oxfmtPluginOptionsJson: string, parentContext: string): Promise<string | null>;
|
|
844
844
|
//#endregion
|
|
845
|
-
export { ArrowParensConfig, CustomGroupItemConfig, EmbeddedLanguageFormattingConfig, EndOfLineConfig, FormatConfig, FormatOptions, GlobSet, HtmlWhitespaceSensitivityConfig, JsdocConfig, JsdocUserConfig, NewlinesBetweenMarker, ObjectWrapConfig, OxfmtConfig, OxfmtOverrideConfig, Oxfmtrc, ProseWrapConfig, QuotePropsConfig, SortGroupItemConfig, SortImportsConfig, SortImportsOptions, SortImportsUserConfig, SortOrderConfig, SortPackageJsonConfig, SortPackageJsonOptions, SortPackageJsonUserConfig, SortTailwindcssConfig, SortTailwindcssOptions, SortTailwindcssUserConfig, SvelteConfig, SvelteUserConfig, TailwindcssOptions, TrailingCommaConfig, defineConfig, format, jsTextToDoc };
|
|
845
|
+
export { type ArrowParensConfig, type CustomGroupItemConfig, type EmbeddedLanguageFormattingConfig, type EndOfLineConfig, type FormatConfig, FormatOptions, type GlobSet, type HtmlWhitespaceSensitivityConfig, type JsdocConfig, type JsdocUserConfig, type NewlinesBetweenMarker, type ObjectWrapConfig, OxfmtConfig, type OxfmtOverrideConfig, type Oxfmtrc, type ProseWrapConfig, type QuotePropsConfig, type SortGroupItemConfig, type SortImportsConfig, SortImportsOptions, type SortImportsUserConfig, type SortOrderConfig, type SortPackageJsonConfig, SortPackageJsonOptions, type SortPackageJsonUserConfig, type SortTailwindcssConfig, SortTailwindcssOptions, type SortTailwindcssUserConfig, type SvelteConfig, type SvelteUserConfig, TailwindcssOptions, type TrailingCommaConfig, defineConfig, format, jsTextToDoc };
|
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-ChKdN0o7.js";
|
|
2
|
+
import { i as sortTailwindClasses, n as formatEmbeddedDoc, r as formatFile, t as formatEmbeddedCode } from "./apis-DOCQy_NG.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 {
|
|
1
|
+
import { a as __toESM, i as __require, t as __commonJSMin } from "./chunk-DSjvVL_1-CrjveNIv.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_961279539c8b58c29c93389b521be834/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-CttUn4xj.js");
|
|
13
13
|
const prettierConfigPath = await resolveConfigFile(join(cwd, "dummy.js"));
|
|
14
14
|
if (!prettierConfigPath) {
|
|
15
15
|
console.log("No Prettier configuration file found.");
|