@prettier/plugin-oxc 0.0.2 → 0.0.4
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 -17
- package/package.json +2 -2
package/THIRD-PARTY-NOTICES.md
CHANGED
package/index.mjs
CHANGED
|
@@ -1894,7 +1894,6 @@ async function parseWithOptions(filepath, text, options2) {
|
|
|
1894
1894
|
const result = await oxcParser.parseAsync(filepath, text, {
|
|
1895
1895
|
preserveParens: true,
|
|
1896
1896
|
showSemanticErrors: false,
|
|
1897
|
-
experimentalRawTransfer: oxcParser.rawTransferSupported(),
|
|
1898
1897
|
...options2
|
|
1899
1898
|
});
|
|
1900
1899
|
const { errors } = result;
|
|
@@ -1921,30 +1920,26 @@ async function parseJs(text, options2) {
|
|
|
1921
1920
|
return postprocess_default(ast, { text, parser: "oxc" });
|
|
1922
1921
|
}
|
|
1923
1922
|
async function parseTs(text, options2) {
|
|
1924
|
-
|
|
1923
|
+
const filepath = options2 == null ? void 0 : options2.filepath;
|
|
1925
1924
|
const sourceType = getSourceType(filepath);
|
|
1926
1925
|
const parseOptions = { sourceType, astType: "ts" };
|
|
1927
1926
|
const isKnownJsx = typeof filepath === "string" && /\.(?:jsx|tsx)$/iu.test(filepath);
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
} else {
|
|
1927
|
+
const isDtsFile = typeof filepath === "string" && filepath.toLowerCase().endsWith(".d.ts");
|
|
1928
|
+
let filenameCombinations = [isDtsFile ? "prettier.d.ts" : "prettier.tsx"];
|
|
1929
|
+
if (!isDtsFile && !isKnownJsx) {
|
|
1932
1930
|
const shouldEnableJsx = jsx_regexp_evaluate_default.test(text);
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
}
|
|
1940
|
-
if (typeof filepath !== "string") {
|
|
1941
|
-
filepath = "prettier.tsx";
|
|
1931
|
+
filenameCombinations = [
|
|
1932
|
+
...[shouldEnableJsx, !shouldEnableJsx].map(
|
|
1933
|
+
(shouldEnableJsx2) => shouldEnableJsx2 ? "prettier.tsx" : "prettier.ts"
|
|
1934
|
+
),
|
|
1935
|
+
"prettier.d.ts"
|
|
1936
|
+
];
|
|
1942
1937
|
}
|
|
1943
1938
|
let result;
|
|
1944
1939
|
try {
|
|
1945
1940
|
result = await tryCombinationsAsync(
|
|
1946
|
-
|
|
1947
|
-
(
|
|
1941
|
+
filenameCombinations.map(
|
|
1942
|
+
(filename) => () => parseWithOptions(filename, text, parseOptions)
|
|
1948
1943
|
)
|
|
1949
1944
|
);
|
|
1950
1945
|
} 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.4",
|
|
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",
|