@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.
@@ -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
@@ -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
- let filepath = options2 == null ? void 0 : options2.filepath;
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
- let parseOptionsCombinations = [];
1929
- if (isKnownJsx) {
1930
- parseOptionsCombinations = [{ ...parseOptions, lang: "tsx" }];
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
- 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";
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
- parseOptionsCombinations.map(
1947
- (parseOptions2) => () => parseWithOptions(filepath, text, parseOptions2)
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.2",
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.73.2"
34
+ "oxc-parser": "0.74.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public",