@kosmojs/biome-formatter 0.0.0

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/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "type": "module",
3
+ "name": "@kosmojs/biome-formatter",
4
+ "version": "0.0.0",
5
+ "author": "Slee Woo",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "files": [
11
+ "pkg/*"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./pkg/src/index.d.ts",
16
+ "default": "./pkg/index.js"
17
+ }
18
+ },
19
+ "dependencies": {
20
+ "@biomejs/js-api": "^4.0.0",
21
+ "@biomejs/wasm-nodejs": "^2.3.4",
22
+ "@kosmojs/devlib": "^0.0.0"
23
+ },
24
+ "devDependencies": {
25
+ "@kosmojs/config": "^0.0.0"
26
+ },
27
+ "scripts": {
28
+ "build": "esbuilder src/index.ts"
29
+ }
30
+ }
package/pkg/index.js ADDED
@@ -0,0 +1,24 @@
1
+ // src/index.ts
2
+ import { Biome, Distribution } from "@biomejs/js-api";
3
+ var biome = await Biome.create({ distribution: Distribution.NODE });
4
+ var { projectKey } = biome.openProject(process.cwd());
5
+ var supportedFiles = [
6
+ //
7
+ /\.tsx?$/,
8
+ /\.jsx?$/,
9
+ /\.json$/
10
+ ];
11
+ var index_default = (config) => {
12
+ biome.applyConfiguration(projectKey, config);
13
+ return {
14
+ moduleImport: import.meta.filename,
15
+ moduleConfig: config,
16
+ formatter: (text, filePath) => {
17
+ return supportedFiles.some((e) => e.test(filePath)) ? biome.formatContent(projectKey, text, { filePath }).content : text;
18
+ }
19
+ };
20
+ };
21
+ export {
22
+ index_default as default
23
+ };
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["import { Biome, type Configuration, Distribution } from \"@biomejs/js-api\";\n\nimport type { FormatterConstructor } from \"@kosmojs/devlib\";\n\nconst biome = await Biome.create({ distribution: Distribution.NODE });\n\nconst { projectKey } = biome.openProject(process.cwd());\n\nconst supportedFiles = [\n //\n /\\.tsx?$/,\n /\\.jsx?$/,\n /\\.json$/,\n];\n\nexport default (config: Configuration): FormatterConstructor<Configuration> => {\n biome.applyConfiguration(projectKey, config);\n return {\n moduleImport: import.meta.filename,\n moduleConfig: config,\n formatter: (text, filePath) => {\n return supportedFiles.some((e) => e.test(filePath))\n ? biome.formatContent(projectKey, text, { filePath }).content\n : text;\n },\n };\n};\n"],
5
+ "mappings": ";AAAA,SAAS,OAA2B,oBAAoB;AAIxD,IAAM,QAAQ,MAAM,MAAM,OAAO,EAAE,cAAc,aAAa,KAAK,CAAC;AAEpE,IAAM,EAAE,WAAW,IAAI,MAAM,YAAY,QAAQ,IAAI,CAAC;AAEtD,IAAM,iBAAiB;AAAA;AAAA,EAErB;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAO,gBAAQ,CAAC,WAA+D;AAC7E,QAAM,mBAAmB,YAAY,MAAM;AAC3C,SAAO;AAAA,IACL,cAAc,YAAY;AAAA,IAC1B,cAAc;AAAA,IACd,WAAW,CAAC,MAAM,aAAa;AAC7B,aAAO,eAAe,KAAK,CAAC,MAAM,EAAE,KAAK,QAAQ,CAAC,IAC9C,MAAM,cAAc,YAAY,MAAM,EAAE,SAAS,CAAC,EAAE,UACpD;AAAA,IACN;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ import { type Configuration } from "@biomejs/js-api";
2
+ import type { FormatterConstructor } from "@kosmojs/devlib";
3
+ declare const _default: (config: Configuration) => FormatterConstructor<Configuration>;
4
+ export default _default;