@jsrepo/transform-biome 0.0.1-beta.0 → 0.0.1-beta.1
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/index.js +1 -39
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,39 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/index.ts
|
|
4
|
-
/**
|
|
5
|
-
* A transform plugin for jsrepo to format code with prettier.
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* import { defineConfig } from "jsrepo";
|
|
9
|
-
* import biome from "@jsrepo/transform-biome";
|
|
10
|
-
*
|
|
11
|
-
* export default defineConfig({
|
|
12
|
-
* // ...
|
|
13
|
-
* transforms: [biome()],
|
|
14
|
-
* });
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* @param options - The options for the transform plugin.
|
|
18
|
-
*/
|
|
19
|
-
function src_default() {
|
|
20
|
-
return { transform: async (code, opts) => {
|
|
21
|
-
return { code: await tryFormat(code, {
|
|
22
|
-
fileName: opts.fileName,
|
|
23
|
-
cwd: opts.cwd
|
|
24
|
-
}) };
|
|
25
|
-
} };
|
|
26
|
-
}
|
|
27
|
-
async function tryFormat(code, { fileName, cwd }) {
|
|
28
|
-
try {
|
|
29
|
-
const biome = await Biome.create({ distribution: Distribution.NODE });
|
|
30
|
-
const { projectKey } = biome.openProject(cwd);
|
|
31
|
-
return biome.formatContent(projectKey, code, { filePath: fileName }).content;
|
|
32
|
-
} catch (err) {
|
|
33
|
-
console.error(err);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
export { src_default as default };
|
|
1
|
+
import{Biome as e,Distribution as t}from"@biomejs/js-api";function n(){return{transform:async(e,t)=>({code:await r(e,{fileName:t.fileName,cwd:t.cwd})})}}async function r(n,{fileName:r,cwd:i}){try{let a=await e.create({distribution:t.NODE}),{projectKey:o}=a.openProject(i);return a.formatContent(o,n,{filePath:r}).content}catch(e){console.error(e);return}}export{n as default};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsrepo/transform-biome",
|
|
3
3
|
"description": "A transform plugin for jsrepo to format code with biome.",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.1",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://jsrepo.dev",
|
|
6
|
+
"homepage": "https://v3.jsrepo.dev",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Aidan Bleser",
|
|
9
9
|
"url": "https://github.com/ieedan"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dist/**/*"
|
|
34
34
|
],
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"jsrepo": "3.0.0-beta.
|
|
36
|
+
"jsrepo": "3.0.0-beta.1"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@biomejs/wasm-nodejs": "^2.2.4",
|