@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.
@@ -153,7 +153,7 @@ Repository: <https://github.com/jestjs/jest.git>
153
153
 
154
154
  ----------------------------------------
155
155
 
156
- ## prettier@v3.6.0-dev
156
+ ## prettier@v3.7.0-dev
157
157
 
158
158
  > Prettier is an opinionated code formatter
159
159
 
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
- let filepath = options2 == null ? void 0 : options2.filepath;
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
- let parseOptionsCombinations = [];
1929
- if (isKnownJsx) {
1930
- parseOptionsCombinations = [{ ...parseOptions, lang: "tsx" }];
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
- parseOptionsCombinations = [shouldEnableJsx, !shouldEnableJsx].map(
1934
- (shouldEnableJsx2) => ({
1935
- ...parseOptions,
1936
- lang: shouldEnableJsx2 ? "tsx" : "ts"
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
- parseOptionsCombinations.map(
1947
- (parseOptions2) => () => parseWithOptions(filepath, text, parseOptions2)
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.2",
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.73.2"
34
+ "oxc-parser": "0.74.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public",