@prettier/plugin-oxc 0.0.2 → 0.0.3
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/THIRD-PARTY-NOTICES.md +1 -1
- package/index.mjs +12 -16
- package/package.json +2 -2
package/THIRD-PARTY-NOTICES.md
CHANGED
package/index.mjs
CHANGED
|
@@ -1921,30 +1921,26 @@ async function parseJs(text, options2) {
|
|
|
1921
1921
|
return postprocess_default(ast, { text, parser: "oxc" });
|
|
1922
1922
|
}
|
|
1923
1923
|
async function parseTs(text, options2) {
|
|
1924
|
-
|
|
1924
|
+
const filepath = options2 == null ? void 0 : options2.filepath;
|
|
1925
1925
|
const sourceType = getSourceType(filepath);
|
|
1926
1926
|
const parseOptions = { sourceType, astType: "ts" };
|
|
1927
1927
|
const isKnownJsx = typeof filepath === "string" && /\.(?:jsx|tsx)$/iu.test(filepath);
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
} else {
|
|
1928
|
+
const isDtsFile = typeof filepath === "string" && filepath.toLowerCase().endsWith(".d.ts");
|
|
1929
|
+
let filenameCombinations = [isDtsFile ? "prettier.d.ts" : "prettier.tsx"];
|
|
1930
|
+
if (!isDtsFile && !isKnownJsx) {
|
|
1932
1931
|
const shouldEnableJsx = jsx_regexp_evaluate_default.test(text);
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
}
|
|
1940
|
-
if (typeof filepath !== "string") {
|
|
1941
|
-
filepath = "prettier.tsx";
|
|
1932
|
+
filenameCombinations = [
|
|
1933
|
+
...[shouldEnableJsx, !shouldEnableJsx].map(
|
|
1934
|
+
(shouldEnableJsx2) => shouldEnableJsx2 ? "prettier.tsx" : "prettier.ts"
|
|
1935
|
+
),
|
|
1936
|
+
"prettier.d.ts"
|
|
1937
|
+
];
|
|
1942
1938
|
}
|
|
1943
1939
|
let result;
|
|
1944
1940
|
try {
|
|
1945
1941
|
result = await tryCombinationsAsync(
|
|
1946
|
-
|
|
1947
|
-
(
|
|
1942
|
+
filenameCombinations.map(
|
|
1943
|
+
(filename) => () => parseWithOptions(filename, text, parseOptions)
|
|
1948
1944
|
)
|
|
1949
1945
|
);
|
|
1950
1946
|
} catch ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prettier/plugin-oxc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Prettier Oxc plugin.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"package.json"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"oxc-parser": "0.
|
|
34
|
+
"oxc-parser": "0.74.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public",
|