@jsrepo/transform-prettier 0.0.1-beta.0 → 0.0.1-beta.2
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.d.ts +2 -1
- package/dist/index.js +2 -42
- package/package.json +8 -6
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,42 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region src/index.ts
|
|
5
|
-
/**
|
|
6
|
-
* A transform plugin for jsrepo to format code with prettier.
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { defineConfig } from "jsrepo";
|
|
10
|
-
* import prettier from "@jsrepo/transform-prettier";
|
|
11
|
-
*
|
|
12
|
-
* export default defineConfig({
|
|
13
|
-
* // ...
|
|
14
|
-
* transforms: [prettier()],
|
|
15
|
-
* });
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @param options - The options for the transform plugin.
|
|
19
|
-
*/
|
|
20
|
-
function src_default(options = {}) {
|
|
21
|
-
const configPromise = prettier.resolveConfig(path.join(process.cwd(), options.configFile ?? ".prettierrc"));
|
|
22
|
-
return { transform: async (code, opts) => {
|
|
23
|
-
const config = await configPromise;
|
|
24
|
-
return { code: await tryFormat(code, {
|
|
25
|
-
fileName: opts.fileName,
|
|
26
|
-
config
|
|
27
|
-
}) };
|
|
28
|
-
} };
|
|
29
|
-
}
|
|
30
|
-
function tryFormat(code, { fileName, config }) {
|
|
31
|
-
try {
|
|
32
|
-
return prettier.format(code, {
|
|
33
|
-
...config,
|
|
34
|
-
filepath: fileName
|
|
35
|
-
});
|
|
36
|
-
} catch {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
//#endregion
|
|
42
|
-
export { src_default as default };
|
|
1
|
+
import e from"node:path";import*as t from"prettier";function n(n={}){let i=t.resolveConfig(e.join(process.cwd(),n.configFile??`.prettierrc`));return{transform:async(e,t)=>{let n=await i;return{code:await r(e,{fileName:t.fileName,config:n})}}}}function r(e,{fileName:n,config:r}){try{return t.format(e,{...r,filepath:n})}catch{return}}export{n as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsrepo/transform-prettier",
|
|
3
3
|
"description": "A transform plugin for jsrepo to format code with prettier.",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.2",
|
|
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"
|
|
@@ -30,15 +30,17 @@
|
|
|
30
30
|
},
|
|
31
31
|
"main": "./dist/index.js",
|
|
32
32
|
"files": [
|
|
33
|
-
"dist/**/*"
|
|
33
|
+
"dist/**/*",
|
|
34
|
+
"!dist/**/*.map"
|
|
34
35
|
],
|
|
35
36
|
"peerDependencies": {
|
|
36
37
|
"prettier": "3.x",
|
|
37
|
-
"jsrepo": "3.0.0-beta.
|
|
38
|
+
"jsrepo": "3.0.0-beta.2"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
41
|
+
"@types/node": "^24.10.0",
|
|
42
|
+
"tsdown": "^0.15.12",
|
|
43
|
+
"typescript": "^5.9.3"
|
|
42
44
|
},
|
|
43
45
|
"scripts": {
|
|
44
46
|
"build": "tsdown",
|