@powerlines/plugin-biome 0.2.122 → 0.2.124

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.cjs CHANGED
@@ -1 +1,87 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});let e=require(`@storm-software/config-tools/types`),t=require(`@stryke/cli/execute`),n=require(`@stryke/fs/exists`),r=require(`@stryke/fs/package-fns`),i=require(`@stryke/path/join`),a=require(`@stryke/path/replace`);function o(o={}){return{name:`biome`,async config(){this.log(e.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `biome` linting plugin.");let t=o.configFile;if(!t)if((0,n.existsSync)((0,i.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`biome.json`)))t=(0,i.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`biome.json`);else if((0,n.existsSync)((0,i.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`biome.jsonc`)))t=(0,i.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`biome.jsonc`);else if((0,n.existsSync)((0,i.joinPaths)(this.workspaceConfig.workspaceRoot,`biome.json`)))t=(0,i.joinPaths)(this.workspaceConfig.workspaceRoot,`biome.json`);else if((0,n.existsSync)((0,i.joinPaths)(this.workspaceConfig.workspaceRoot,`biome.jsonc`)))t=(0,i.joinPaths)(this.workspaceConfig.workspaceRoot,`biome.jsonc`);else throw Error("No Biome configuration file found. Please specify a valid config file path in the Biome plugin's `configFile` options.");return{lint:{biome:{configFile:t,maxDiagnostics:20,diagnosticLevel:`info`,fix:!0,logKind:`pretty`,format:`stylish`,vcsEnabled:!0,vcsDefaultBranch:this.workspaceConfig.branch||`main`,...o}}}},async lint(){this.log(e.LogLevelLabel.TRACE,`Linting project files with Biome.`);let n=[];if(this.config.lint.biome.params&&n.push(...this.config.lint.biome.params.split(` `).filter(Boolean)),n.includes(`--log-level`)||n.push(`--log-level`,!this.config.logLevel||this.config.logLevel===`trace`||this.config.logLevel===`debug`?`info`:this.config.logLevel),!n.includes(`--verbose`)&&(this.config.logLevel===`trace`||this.config.logLevel===`debug`||this.config.mode===`development`)&&n.push(`--verbose`),this.config.lint.biome.fix!==!1&&!n.includes(`--fix`)&&(n.push(`--fix`),this.config.lint.biome.fix===`unsafe`&&!n.includes(`--unsafe`)&&n.push(`--unsafe`)),this.config.lint.biome.configFile&&!n.includes(`--config-path`)&&n.push(`--config-path`,this.config.lint.biome.configFile),this.config.lint.biome.changed&&!n.includes(`--changed`)&&n.push(`--changed`),this.config.lint.biome.staged&&!n.includes(`--staged`)&&n.push(`--staged`),this.config.lint.biome.ignorePatterns&&!n.includes(`--ignore`)&&n.push(`--ignore`,Array.isArray(this.config.lint.biome.ignorePatterns)?this.config.lint.biome.ignorePatterns.join(`,`):this.config.lint.biome.ignorePatterns),this.config.lint.biome.suppress&&!n.includes(`--suppress`)&&n.push(`--suppress`),this.config.lint.biome.only&&!n.includes(`--only`)&&n.push(`--only`,Array.isArray(this.config.lint.biome.only)?this.config.lint.biome.only.join(`,`):this.config.lint.biome.only),this.config.lint.biome.skip&&!n.includes(`--skip`)&&n.push(`--skip`,Array.isArray(this.config.lint.biome.skip)?this.config.lint.biome.skip.join(`,`):this.config.lint.biome.skip),this.config.lint.biome.stdinFilePath&&!n.includes(`--stdin-file-path`)&&n.push(`--stdin-file-path`,this.config.lint.biome.stdinFilePath),this.config.lint.biome.maxDiagnostics!==void 0&&!n.includes(`--max-diagnostics`)&&n.push(`--max-diagnostics`,this.config.lint.biome.maxDiagnostics.toString()),this.config.lint.biome.diagnosticLevel&&!n.includes(`--diagnostic-level`)&&n.push(`--diagnostic-level`,this.config.lint.biome.diagnosticLevel),this.config.lint.biome.errorOnWarnings&&!n.includes(`--error-on-warnings`)&&n.push(`--error-on-warnings`),this.config.lint.biome.jsonParseAllowComments&&!n.includes(`--json-parse-allow-comments`)&&n.push(`--json-parse-allow-comments`),this.config.lint.biome.jsonParseAllowTrailingCommas&&!n.includes(`--json-parse-allow-trailing-commas`)&&n.push(`--json-parse-allow-trailing-commas`),this.config.lint.biome.reporter&&!n.includes(`--reporter`)&&n.push(`--reporter`,this.config.lint.biome.reporter),this.config.lint.biome.logKind&&!n.includes(`--log-kind`)&&n.push(`--log-kind`,this.config.lint.biome.logKind),this.config.lint.biome.filesMaxSize&&!n.includes(`--files-max-size`)&&n.push(`--files-max-size`,this.config.lint.biome.filesMaxSize.toString()),this.config.lint.biome.filesIgnoreUnknown&&!n.includes(`--files-ignore-unknown`)&&n.push(`--files-ignore-unknown`),this.config.lint.biome.vcsEnabled&&!n.includes(`--vcs-enabled`)&&(n.push(`--vcs-enabled`),n.includes(`--vcs-root`)||n.push(`--vcs-root`,this.workspaceConfig.workspaceRoot),this.config.lint.biome.vcsClientKind&&!n.includes(`--vcs-client-kind`)&&n.push(`--vcs-client-kind`,this.config.lint.biome.vcsClientKind),this.config.lint.biome.vcsUseIgnoreFile&&!n.includes(`--vcs-use-ignore-file`)&&n.push(`--vcs-use-ignore-file`),this.config.lint.biome.vcsDefaultBranch&&!n.includes(`--vcs-default-branch`)&&n.push(`--vcs-default-branch`,this.config.lint.biome.vcsDefaultBranch)),this.config.lint.biome.biomePath){n.unshift(this.config.lint.biome.biomePath,this.config.sourceRoot);let e=await(0,t.execute)(n.join(` `),this.workspaceConfig.workspaceRoot);if(e.failed)throw Error(`Biome process exited with code ${e.exitCode}.`)}else{let e=await(0,r.isPackageListed)(`@biomejs/biome`,this.config.projectRoot);n.unshift(e?(0,a.replacePath)(this.config.sourceRoot,this.config.projectRoot):this.config.sourceRoot);let o=await(0,t.executePackage)(`biome`,n,e?(0,i.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot):this.config.projectRoot);if(o.failed)throw Error(`Biome process exited with code ${o.exitCode}.`)}}}}var s=o;exports.default=s,exports.plugin=o;
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
3
+ let __stryke_cli_execute = require("@stryke/cli/execute");
4
+ let __stryke_fs_exists = require("@stryke/fs/exists");
5
+ let __stryke_fs_package_fns = require("@stryke/fs/package-fns");
6
+ let __stryke_path_join = require("@stryke/path/join");
7
+ let __stryke_path_replace = require("@stryke/path/replace");
8
+
9
+ //#region src/index.ts
10
+ /**
11
+ * A Powerlines plugin to assist in linting a project with Biome.
12
+ */
13
+ function plugin(options = {}) {
14
+ return {
15
+ name: "biome",
16
+ async config() {
17
+ this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `biome` linting plugin.");
18
+ let configFile = options.configFile;
19
+ if (!configFile) if ((0, __stryke_fs_exists.existsSync)((0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "biome.json"))) configFile = (0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "biome.json");
20
+ else if ((0, __stryke_fs_exists.existsSync)((0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "biome.jsonc"))) configFile = (0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "biome.jsonc");
21
+ else if ((0, __stryke_fs_exists.existsSync)((0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, "biome.json"))) configFile = (0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, "biome.json");
22
+ else if ((0, __stryke_fs_exists.existsSync)((0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, "biome.jsonc"))) configFile = (0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, "biome.jsonc");
23
+ else throw new Error(`No Biome configuration file found. Please specify a valid config file path in the Biome plugin's \`configFile\` options.`);
24
+ return { lint: { biome: {
25
+ configFile,
26
+ maxDiagnostics: 20,
27
+ diagnosticLevel: "info",
28
+ fix: true,
29
+ logKind: "pretty",
30
+ format: "stylish",
31
+ vcsEnabled: true,
32
+ vcsDefaultBranch: this.workspaceConfig.branch || "main",
33
+ ...options
34
+ } } };
35
+ },
36
+ async lint() {
37
+ this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Linting project files with Biome.`);
38
+ const args = [];
39
+ if (this.config.lint.biome.params) args.push(...this.config.lint.biome.params.split(" ").filter(Boolean));
40
+ if (!args.includes("--log-level")) args.push("--log-level", !this.config.logLevel || this.config.logLevel === "trace" || this.config.logLevel === "debug" ? "info" : this.config.logLevel);
41
+ if (!args.includes("--verbose") && (this.config.logLevel === "trace" || this.config.logLevel === "debug" || this.config.mode === "development")) args.push("--verbose");
42
+ if (this.config.lint.biome.fix !== false && !args.includes("--fix")) {
43
+ args.push("--fix");
44
+ if (this.config.lint.biome.fix === "unsafe" && !args.includes("--unsafe")) args.push("--unsafe");
45
+ }
46
+ if (this.config.lint.biome.configFile && !args.includes("--config-path")) args.push("--config-path", this.config.lint.biome.configFile);
47
+ if (this.config.lint.biome.changed && !args.includes("--changed")) args.push("--changed");
48
+ if (this.config.lint.biome.staged && !args.includes("--staged")) args.push("--staged");
49
+ if (this.config.lint.biome.ignorePatterns && !args.includes("--ignore")) args.push("--ignore", Array.isArray(this.config.lint.biome.ignorePatterns) ? this.config.lint.biome.ignorePatterns.join(",") : this.config.lint.biome.ignorePatterns);
50
+ if (this.config.lint.biome.suppress && !args.includes("--suppress")) args.push("--suppress");
51
+ if (this.config.lint.biome.only && !args.includes("--only")) args.push("--only", Array.isArray(this.config.lint.biome.only) ? this.config.lint.biome.only.join(",") : this.config.lint.biome.only);
52
+ if (this.config.lint.biome.skip && !args.includes("--skip")) args.push("--skip", Array.isArray(this.config.lint.biome.skip) ? this.config.lint.biome.skip.join(",") : this.config.lint.biome.skip);
53
+ if (this.config.lint.biome.stdinFilePath && !args.includes("--stdin-file-path")) args.push("--stdin-file-path", this.config.lint.biome.stdinFilePath);
54
+ if (this.config.lint.biome.maxDiagnostics !== void 0 && !args.includes("--max-diagnostics")) args.push("--max-diagnostics", this.config.lint.biome.maxDiagnostics.toString());
55
+ if (this.config.lint.biome.diagnosticLevel && !args.includes("--diagnostic-level")) args.push("--diagnostic-level", this.config.lint.biome.diagnosticLevel);
56
+ if (this.config.lint.biome.errorOnWarnings && !args.includes("--error-on-warnings")) args.push("--error-on-warnings");
57
+ if (this.config.lint.biome.jsonParseAllowComments && !args.includes("--json-parse-allow-comments")) args.push("--json-parse-allow-comments");
58
+ if (this.config.lint.biome.jsonParseAllowTrailingCommas && !args.includes("--json-parse-allow-trailing-commas")) args.push("--json-parse-allow-trailing-commas");
59
+ if (this.config.lint.biome.reporter && !args.includes("--reporter")) args.push("--reporter", this.config.lint.biome.reporter);
60
+ if (this.config.lint.biome.logKind && !args.includes("--log-kind")) args.push("--log-kind", this.config.lint.biome.logKind);
61
+ if (this.config.lint.biome.filesMaxSize && !args.includes("--files-max-size")) args.push("--files-max-size", this.config.lint.biome.filesMaxSize.toString());
62
+ if (this.config.lint.biome.filesIgnoreUnknown && !args.includes("--files-ignore-unknown")) args.push("--files-ignore-unknown");
63
+ if (this.config.lint.biome.vcsEnabled && !args.includes("--vcs-enabled")) {
64
+ args.push("--vcs-enabled");
65
+ if (!args.includes("--vcs-root")) args.push("--vcs-root", this.workspaceConfig.workspaceRoot);
66
+ if (this.config.lint.biome.vcsClientKind && !args.includes("--vcs-client-kind")) args.push("--vcs-client-kind", this.config.lint.biome.vcsClientKind);
67
+ if (this.config.lint.biome.vcsUseIgnoreFile && !args.includes("--vcs-use-ignore-file")) args.push("--vcs-use-ignore-file");
68
+ if (this.config.lint.biome.vcsDefaultBranch && !args.includes("--vcs-default-branch")) args.push("--vcs-default-branch", this.config.lint.biome.vcsDefaultBranch);
69
+ }
70
+ if (!this.config.lint.biome.biomePath) {
71
+ const isBiomeListed = await (0, __stryke_fs_package_fns.isPackageListed)("@biomejs/biome", this.config.projectRoot);
72
+ args.unshift(isBiomeListed ? (0, __stryke_path_replace.replacePath)(this.config.sourceRoot, this.config.projectRoot) : this.config.sourceRoot);
73
+ const result = await (0, __stryke_cli_execute.executePackage)("biome", args, isBiomeListed ? (0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot) : this.config.projectRoot);
74
+ if (result.failed) throw new Error(`Biome process exited with code ${result.exitCode}.`);
75
+ } else {
76
+ args.unshift(this.config.lint.biome.biomePath, this.config.sourceRoot);
77
+ const result = await (0, __stryke_cli_execute.execute)(args.join(" "), this.workspaceConfig.workspaceRoot);
78
+ if (result.failed) throw new Error(`Biome process exited with code ${result.exitCode}.`);
79
+ }
80
+ }
81
+ };
82
+ }
83
+ var src_default = plugin;
84
+
85
+ //#endregion
86
+ exports.default = src_default;
87
+ exports.plugin = plugin;
package/dist/index.mjs CHANGED
@@ -1 +1,85 @@
1
- import{LogLevelLabel as e}from"@storm-software/config-tools/types";import{execute as t,executePackage as n}from"@stryke/cli/execute";import{existsSync as r}from"@stryke/fs/exists";import{isPackageListed as i}from"@stryke/fs/package-fns";import{joinPaths as a}from"@stryke/path/join";import{replacePath as o}from"@stryke/path/replace";function s(s={}){return{name:`biome`,async config(){this.log(e.TRACE,"Providing default configuration for the Powerlines `biome` linting plugin.");let t=s.configFile;if(!t)if(r(a(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`biome.json`)))t=a(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`biome.json`);else if(r(a(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`biome.jsonc`)))t=a(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`biome.jsonc`);else if(r(a(this.workspaceConfig.workspaceRoot,`biome.json`)))t=a(this.workspaceConfig.workspaceRoot,`biome.json`);else if(r(a(this.workspaceConfig.workspaceRoot,`biome.jsonc`)))t=a(this.workspaceConfig.workspaceRoot,`biome.jsonc`);else throw Error("No Biome configuration file found. Please specify a valid config file path in the Biome plugin's `configFile` options.");return{lint:{biome:{configFile:t,maxDiagnostics:20,diagnosticLevel:`info`,fix:!0,logKind:`pretty`,format:`stylish`,vcsEnabled:!0,vcsDefaultBranch:this.workspaceConfig.branch||`main`,...s}}}},async lint(){this.log(e.TRACE,`Linting project files with Biome.`);let r=[];if(this.config.lint.biome.params&&r.push(...this.config.lint.biome.params.split(` `).filter(Boolean)),r.includes(`--log-level`)||r.push(`--log-level`,!this.config.logLevel||this.config.logLevel===`trace`||this.config.logLevel===`debug`?`info`:this.config.logLevel),!r.includes(`--verbose`)&&(this.config.logLevel===`trace`||this.config.logLevel===`debug`||this.config.mode===`development`)&&r.push(`--verbose`),this.config.lint.biome.fix!==!1&&!r.includes(`--fix`)&&(r.push(`--fix`),this.config.lint.biome.fix===`unsafe`&&!r.includes(`--unsafe`)&&r.push(`--unsafe`)),this.config.lint.biome.configFile&&!r.includes(`--config-path`)&&r.push(`--config-path`,this.config.lint.biome.configFile),this.config.lint.biome.changed&&!r.includes(`--changed`)&&r.push(`--changed`),this.config.lint.biome.staged&&!r.includes(`--staged`)&&r.push(`--staged`),this.config.lint.biome.ignorePatterns&&!r.includes(`--ignore`)&&r.push(`--ignore`,Array.isArray(this.config.lint.biome.ignorePatterns)?this.config.lint.biome.ignorePatterns.join(`,`):this.config.lint.biome.ignorePatterns),this.config.lint.biome.suppress&&!r.includes(`--suppress`)&&r.push(`--suppress`),this.config.lint.biome.only&&!r.includes(`--only`)&&r.push(`--only`,Array.isArray(this.config.lint.biome.only)?this.config.lint.biome.only.join(`,`):this.config.lint.biome.only),this.config.lint.biome.skip&&!r.includes(`--skip`)&&r.push(`--skip`,Array.isArray(this.config.lint.biome.skip)?this.config.lint.biome.skip.join(`,`):this.config.lint.biome.skip),this.config.lint.biome.stdinFilePath&&!r.includes(`--stdin-file-path`)&&r.push(`--stdin-file-path`,this.config.lint.biome.stdinFilePath),this.config.lint.biome.maxDiagnostics!==void 0&&!r.includes(`--max-diagnostics`)&&r.push(`--max-diagnostics`,this.config.lint.biome.maxDiagnostics.toString()),this.config.lint.biome.diagnosticLevel&&!r.includes(`--diagnostic-level`)&&r.push(`--diagnostic-level`,this.config.lint.biome.diagnosticLevel),this.config.lint.biome.errorOnWarnings&&!r.includes(`--error-on-warnings`)&&r.push(`--error-on-warnings`),this.config.lint.biome.jsonParseAllowComments&&!r.includes(`--json-parse-allow-comments`)&&r.push(`--json-parse-allow-comments`),this.config.lint.biome.jsonParseAllowTrailingCommas&&!r.includes(`--json-parse-allow-trailing-commas`)&&r.push(`--json-parse-allow-trailing-commas`),this.config.lint.biome.reporter&&!r.includes(`--reporter`)&&r.push(`--reporter`,this.config.lint.biome.reporter),this.config.lint.biome.logKind&&!r.includes(`--log-kind`)&&r.push(`--log-kind`,this.config.lint.biome.logKind),this.config.lint.biome.filesMaxSize&&!r.includes(`--files-max-size`)&&r.push(`--files-max-size`,this.config.lint.biome.filesMaxSize.toString()),this.config.lint.biome.filesIgnoreUnknown&&!r.includes(`--files-ignore-unknown`)&&r.push(`--files-ignore-unknown`),this.config.lint.biome.vcsEnabled&&!r.includes(`--vcs-enabled`)&&(r.push(`--vcs-enabled`),r.includes(`--vcs-root`)||r.push(`--vcs-root`,this.workspaceConfig.workspaceRoot),this.config.lint.biome.vcsClientKind&&!r.includes(`--vcs-client-kind`)&&r.push(`--vcs-client-kind`,this.config.lint.biome.vcsClientKind),this.config.lint.biome.vcsUseIgnoreFile&&!r.includes(`--vcs-use-ignore-file`)&&r.push(`--vcs-use-ignore-file`),this.config.lint.biome.vcsDefaultBranch&&!r.includes(`--vcs-default-branch`)&&r.push(`--vcs-default-branch`,this.config.lint.biome.vcsDefaultBranch)),this.config.lint.biome.biomePath){r.unshift(this.config.lint.biome.biomePath,this.config.sourceRoot);let e=await t(r.join(` `),this.workspaceConfig.workspaceRoot);if(e.failed)throw Error(`Biome process exited with code ${e.exitCode}.`)}else{let e=await i(`@biomejs/biome`,this.config.projectRoot);r.unshift(e?o(this.config.sourceRoot,this.config.projectRoot):this.config.sourceRoot);let t=await n(`biome`,r,e?a(this.workspaceConfig.workspaceRoot,this.config.projectRoot):this.config.projectRoot);if(t.failed)throw Error(`Biome process exited with code ${t.exitCode}.`)}}}}var c=s;export{c as default,s as plugin};
1
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
2
+ import { execute, executePackage } from "@stryke/cli/execute";
3
+ import { existsSync } from "@stryke/fs/exists";
4
+ import { isPackageListed } from "@stryke/fs/package-fns";
5
+ import { joinPaths } from "@stryke/path/join";
6
+ import { replacePath } from "@stryke/path/replace";
7
+
8
+ //#region src/index.ts
9
+ /**
10
+ * A Powerlines plugin to assist in linting a project with Biome.
11
+ */
12
+ function plugin(options = {}) {
13
+ return {
14
+ name: "biome",
15
+ async config() {
16
+ this.log(LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `biome` linting plugin.");
17
+ let configFile = options.configFile;
18
+ if (!configFile) if (existsSync(joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "biome.json"))) configFile = joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "biome.json");
19
+ else if (existsSync(joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "biome.jsonc"))) configFile = joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "biome.jsonc");
20
+ else if (existsSync(joinPaths(this.workspaceConfig.workspaceRoot, "biome.json"))) configFile = joinPaths(this.workspaceConfig.workspaceRoot, "biome.json");
21
+ else if (existsSync(joinPaths(this.workspaceConfig.workspaceRoot, "biome.jsonc"))) configFile = joinPaths(this.workspaceConfig.workspaceRoot, "biome.jsonc");
22
+ else throw new Error(`No Biome configuration file found. Please specify a valid config file path in the Biome plugin's \`configFile\` options.`);
23
+ return { lint: { biome: {
24
+ configFile,
25
+ maxDiagnostics: 20,
26
+ diagnosticLevel: "info",
27
+ fix: true,
28
+ logKind: "pretty",
29
+ format: "stylish",
30
+ vcsEnabled: true,
31
+ vcsDefaultBranch: this.workspaceConfig.branch || "main",
32
+ ...options
33
+ } } };
34
+ },
35
+ async lint() {
36
+ this.log(LogLevelLabel.TRACE, `Linting project files with Biome.`);
37
+ const args = [];
38
+ if (this.config.lint.biome.params) args.push(...this.config.lint.biome.params.split(" ").filter(Boolean));
39
+ if (!args.includes("--log-level")) args.push("--log-level", !this.config.logLevel || this.config.logLevel === "trace" || this.config.logLevel === "debug" ? "info" : this.config.logLevel);
40
+ if (!args.includes("--verbose") && (this.config.logLevel === "trace" || this.config.logLevel === "debug" || this.config.mode === "development")) args.push("--verbose");
41
+ if (this.config.lint.biome.fix !== false && !args.includes("--fix")) {
42
+ args.push("--fix");
43
+ if (this.config.lint.biome.fix === "unsafe" && !args.includes("--unsafe")) args.push("--unsafe");
44
+ }
45
+ if (this.config.lint.biome.configFile && !args.includes("--config-path")) args.push("--config-path", this.config.lint.biome.configFile);
46
+ if (this.config.lint.biome.changed && !args.includes("--changed")) args.push("--changed");
47
+ if (this.config.lint.biome.staged && !args.includes("--staged")) args.push("--staged");
48
+ if (this.config.lint.biome.ignorePatterns && !args.includes("--ignore")) args.push("--ignore", Array.isArray(this.config.lint.biome.ignorePatterns) ? this.config.lint.biome.ignorePatterns.join(",") : this.config.lint.biome.ignorePatterns);
49
+ if (this.config.lint.biome.suppress && !args.includes("--suppress")) args.push("--suppress");
50
+ if (this.config.lint.biome.only && !args.includes("--only")) args.push("--only", Array.isArray(this.config.lint.biome.only) ? this.config.lint.biome.only.join(",") : this.config.lint.biome.only);
51
+ if (this.config.lint.biome.skip && !args.includes("--skip")) args.push("--skip", Array.isArray(this.config.lint.biome.skip) ? this.config.lint.biome.skip.join(",") : this.config.lint.biome.skip);
52
+ if (this.config.lint.biome.stdinFilePath && !args.includes("--stdin-file-path")) args.push("--stdin-file-path", this.config.lint.biome.stdinFilePath);
53
+ if (this.config.lint.biome.maxDiagnostics !== void 0 && !args.includes("--max-diagnostics")) args.push("--max-diagnostics", this.config.lint.biome.maxDiagnostics.toString());
54
+ if (this.config.lint.biome.diagnosticLevel && !args.includes("--diagnostic-level")) args.push("--diagnostic-level", this.config.lint.biome.diagnosticLevel);
55
+ if (this.config.lint.biome.errorOnWarnings && !args.includes("--error-on-warnings")) args.push("--error-on-warnings");
56
+ if (this.config.lint.biome.jsonParseAllowComments && !args.includes("--json-parse-allow-comments")) args.push("--json-parse-allow-comments");
57
+ if (this.config.lint.biome.jsonParseAllowTrailingCommas && !args.includes("--json-parse-allow-trailing-commas")) args.push("--json-parse-allow-trailing-commas");
58
+ if (this.config.lint.biome.reporter && !args.includes("--reporter")) args.push("--reporter", this.config.lint.biome.reporter);
59
+ if (this.config.lint.biome.logKind && !args.includes("--log-kind")) args.push("--log-kind", this.config.lint.biome.logKind);
60
+ if (this.config.lint.biome.filesMaxSize && !args.includes("--files-max-size")) args.push("--files-max-size", this.config.lint.biome.filesMaxSize.toString());
61
+ if (this.config.lint.biome.filesIgnoreUnknown && !args.includes("--files-ignore-unknown")) args.push("--files-ignore-unknown");
62
+ if (this.config.lint.biome.vcsEnabled && !args.includes("--vcs-enabled")) {
63
+ args.push("--vcs-enabled");
64
+ if (!args.includes("--vcs-root")) args.push("--vcs-root", this.workspaceConfig.workspaceRoot);
65
+ if (this.config.lint.biome.vcsClientKind && !args.includes("--vcs-client-kind")) args.push("--vcs-client-kind", this.config.lint.biome.vcsClientKind);
66
+ if (this.config.lint.biome.vcsUseIgnoreFile && !args.includes("--vcs-use-ignore-file")) args.push("--vcs-use-ignore-file");
67
+ if (this.config.lint.biome.vcsDefaultBranch && !args.includes("--vcs-default-branch")) args.push("--vcs-default-branch", this.config.lint.biome.vcsDefaultBranch);
68
+ }
69
+ if (!this.config.lint.biome.biomePath) {
70
+ const isBiomeListed = await isPackageListed("@biomejs/biome", this.config.projectRoot);
71
+ args.unshift(isBiomeListed ? replacePath(this.config.sourceRoot, this.config.projectRoot) : this.config.sourceRoot);
72
+ const result = await executePackage("biome", args, isBiomeListed ? joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot) : this.config.projectRoot);
73
+ if (result.failed) throw new Error(`Biome process exited with code ${result.exitCode}.`);
74
+ } else {
75
+ args.unshift(this.config.lint.biome.biomePath, this.config.sourceRoot);
76
+ const result = await execute(args.join(" "), this.workspaceConfig.workspaceRoot);
77
+ if (result.failed) throw new Error(`Biome process exited with code ${result.exitCode}.`);
78
+ }
79
+ }
80
+ };
81
+ }
82
+ var src_default = plugin;
83
+
84
+ //#endregion
85
+ export { src_default as default, plugin };
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
78
78
  */
79
79
  allowReturnOutsideFunction?: boolean;
80
80
  }
81
+ interface EmitOptions extends WriteOptions {
82
+ /**
83
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
84
+ */
85
+ emitWithBundler?: boolean;
86
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
87
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
88
+ }
81
89
  /**
82
90
  * Options for emitting entry virtual files
83
91
  */
84
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
92
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
85
93
  /**
86
94
  * The unresolved Powerlines context.
87
95
  *
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
292
300
  * The Powerlines builtin virtual files
293
301
  */
294
302
  getBuiltins: () => Promise<VirtualFile[]>;
303
+ /**
304
+ * Resolves a file and writes it to the VFS if it does not already exist
305
+ *
306
+ * @param code - The source code of the file
307
+ * @param path - The path to write the file to
308
+ * @param options - Additional options for writing the file
309
+ */
310
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
311
+ /**
312
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
313
+ *
314
+ * @param code - The source code of the file
315
+ * @param path - The path to write the file to
316
+ * @param options - Additional options for writing the file
317
+ */
318
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
295
319
  /**
296
320
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
297
321
  *
@@ -300,7 +324,16 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
300
324
  * @param path - An optional path to write the builtin file to
301
325
  * @param options - Additional options for writing the builtin file
302
326
  */
303
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
327
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
328
+ /**
329
+ * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
330
+ *
331
+ * @param code - The source code of the builtin file
332
+ * @param id - The unique identifier of the builtin file
333
+ * @param path - An optional path to write the builtin file to
334
+ * @param options - Additional options for writing the builtin file
335
+ */
336
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
304
337
  /**
305
338
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
306
339
  *
@@ -309,6 +342,14 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
309
342
  * @param options - Additional options for writing the entry file
310
343
  */
311
344
  emitEntry: (code: string, path: string, options?: EmitEntryOptions) => Promise<void>;
345
+ /**
346
+ * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
347
+ *
348
+ * @param code - The source code of the entry file
349
+ * @param path - An optional path to write the entry file to
350
+ * @param options - Additional options for writing the entry file
351
+ */
352
+ emitEntrySync: (code: string, path: string, options?: EmitEntryOptions) => void;
312
353
  /**
313
354
  * A function to update the context fields using a new user configuration options
314
355
  */
@@ -80,10 +80,18 @@ interface ParseOptions extends ParserOptions {
80
80
  */
81
81
  allowReturnOutsideFunction?: boolean;
82
82
  }
83
+ interface EmitOptions extends WriteOptions {
84
+ /**
85
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
86
+ */
87
+ emitWithBundler?: boolean;
88
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
89
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
90
+ }
83
91
  /**
84
92
  * Options for emitting entry virtual files
85
93
  */
86
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
94
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
87
95
  /**
88
96
  * The unresolved Powerlines context.
89
97
  *
@@ -294,6 +302,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
294
302
  * The Powerlines builtin virtual files
295
303
  */
296
304
  getBuiltins: () => Promise<VirtualFile[]>;
305
+ /**
306
+ * Resolves a file and writes it to the VFS if it does not already exist
307
+ *
308
+ * @param code - The source code of the file
309
+ * @param path - The path to write the file to
310
+ * @param options - Additional options for writing the file
311
+ */
312
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
313
+ /**
314
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
315
+ *
316
+ * @param code - The source code of the file
317
+ * @param path - The path to write the file to
318
+ * @param options - Additional options for writing the file
319
+ */
320
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
297
321
  /**
298
322
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
299
323
  *
@@ -302,7 +326,16 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
302
326
  * @param path - An optional path to write the builtin file to
303
327
  * @param options - Additional options for writing the builtin file
304
328
  */
305
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
329
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
330
+ /**
331
+ * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
332
+ *
333
+ * @param code - The source code of the builtin file
334
+ * @param id - The unique identifier of the builtin file
335
+ * @param path - An optional path to write the builtin file to
336
+ * @param options - Additional options for writing the builtin file
337
+ */
338
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
306
339
  /**
307
340
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
308
341
  *
@@ -311,6 +344,14 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
311
344
  * @param options - Additional options for writing the entry file
312
345
  */
313
346
  emitEntry: (code: string, path: string, options?: EmitEntryOptions) => Promise<void>;
347
+ /**
348
+ * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
349
+ *
350
+ * @param code - The source code of the entry file
351
+ * @param path - An optional path to write the entry file to
352
+ * @param options - Additional options for writing the entry file
353
+ */
354
+ emitEntrySync: (code: string, path: string, options?: EmitEntryOptions) => void;
314
355
  /**
315
356
  * A function to update the context fields using a new user configuration options
316
357
  */
@@ -13,6 +13,13 @@ interface StorageAdapter {
13
13
  * A name identifying the storage adapter type.
14
14
  */
15
15
  name: string;
16
+ /**
17
+ * The storage preset for the adapter.
18
+ *
19
+ * @remarks
20
+ * This can be used as an alternate way to identify the type of storage being used.
21
+ */
22
+ preset?: StoragePreset | null;
16
23
  /**
17
24
  * Checks if a key exists in the storage.
18
25
  *
@@ -207,6 +214,13 @@ interface WriteOptions {
207
214
  * @defaultValue false
208
215
  */
209
216
  skipFormat?: boolean;
217
+ /**
218
+ * The storage preset or adapter name for the output file.
219
+ *
220
+ * @remarks
221
+ * If not specified, the output mode will be determined by the provided `output.mode` value.
222
+ */
223
+ storage?: StoragePreset | string;
210
224
  /**
211
225
  * Additional metadata for the file.
212
226
  */
@@ -13,6 +13,13 @@ interface StorageAdapter {
13
13
  * A name identifying the storage adapter type.
14
14
  */
15
15
  name: string;
16
+ /**
17
+ * The storage preset for the adapter.
18
+ *
19
+ * @remarks
20
+ * This can be used as an alternate way to identify the type of storage being used.
21
+ */
22
+ preset?: StoragePreset | null;
16
23
  /**
17
24
  * Checks if a key exists in the storage.
18
25
  *
@@ -207,6 +214,13 @@ interface WriteOptions {
207
214
  * @defaultValue false
208
215
  */
209
216
  skipFormat?: boolean;
217
+ /**
218
+ * The storage preset or adapter name for the output file.
219
+ *
220
+ * @remarks
221
+ * If not specified, the output mode will be determined by the provided `output.mode` value.
222
+ */
223
+ storage?: StoragePreset | string;
210
224
  /**
211
225
  * Additional metadata for the file.
212
226
  */
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1 @@
1
- export{};
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-biome",
3
- "version": "0.2.122",
3
+ "version": "0.2.124",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for running Biome linting on the codebase.",
6
6
  "repository": {
@@ -103,19 +103,19 @@
103
103
  "peerDependenciesMeta": { "@biomejs/biome": { "optional": false } },
104
104
  "dependencies": {
105
105
  "@storm-software/config-tools": "^1.188.74",
106
- "@stryke/cli": "^0.12.36",
107
- "@stryke/convert": "^0.6.29",
108
- "@stryke/fs": "^0.33.26",
109
- "@stryke/path": "^0.24.0",
106
+ "@stryke/cli": "^0.12.37",
107
+ "@stryke/convert": "^0.6.30",
108
+ "@stryke/fs": "^0.33.27",
109
+ "@stryke/path": "^0.24.1",
110
110
  "defu": "^6.1.4",
111
- "powerlines": "^0.36.21"
111
+ "powerlines": "^0.36.23"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@biomejs/biome": "^2.3.10",
115
- "@powerlines/nx": "^0.11.47",
115
+ "@powerlines/nx": "^0.11.49",
116
116
  "@storm-software/tsup": "^0.2.72",
117
117
  "@types/node": "^24.10.4"
118
118
  },
119
119
  "publishConfig": { "access": "public" },
120
- "gitHead": "b16324cf857ea5743fd7ad06e18607b1ba32abe0"
120
+ "gitHead": "be47e546b48b9a82e460b5c5d4f02fb66e821f18"
121
121
  }