@powerlines/plugin-stylelint 0.1.121 → 0.1.122

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.
@@ -1 +1,29 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
package/dist/index.cjs CHANGED
@@ -1 +1,62 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`@stryke/fs/get-parent-path`),r=require(`@stryke/path/append`),i=require(`@stryke/path/join`),a=require(`defu`),o=require(`stylelint`);o=e.__toESM(o);function s(e={}){return{name:`stylelint`,async config(){return this.log(t.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `stylelint` build plugin."),{lint:{stylelint:(0,a.defu)(e,{configFile:(0,n.getParentPath)([`stylelint.config.js`,`stylelint.config.mjs`,`stylelint.config.cjs`,`stylelint.config.ts`,`stylelint.config.mts`,`stylelint.config.cts`,`.stylelintrc.js`,`.stylelintrc.cjs`,`.stylelintrc.yaml`,`.stylelintrc.yml`,`.stylelintrc.json`,`.stylelintrc`],this.config.projectRoot,{ignoreCase:!0,skipCwd:!1,includeNameInResults:!0}),cwd:(0,i.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),silent:this.config.logLevel!==null,fix:!0})}}},async lint(){this.log(t.LogLevelLabel.TRACE,`Linting project files with Stylelint.`);let n=await o.default.lint(e);if(this.config.lint.stylelint.outputFile&&await this.fs.write((0,r.appendPath)(this.config.lint.stylelint.outputFile,this.config.projectRoot),n.report),!this.config.lint.stylelint.silent){this.log(t.LogLevelLabel.INFO,n.report);let e=n.results.map(e=>e.warnings.filter(e=>e.severity===`warning`)).reduce((e,t)=>e+t.length,0);e>0?this.log(t.LogLevelLabel.WARN,`${e} Stylelint linting warnings found in the listed files.`):n.errored?this.log(t.LogLevelLabel.ERROR,`Stylelint linting errors found in the listed files.`):this.log(t.LogLevelLabel.INFO,`All files pass Stylelint linting.`)}}}}var c=s;exports.default=c,exports.plugin=s;
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
4
+ let __stryke_fs_get_parent_path = require("@stryke/fs/get-parent-path");
5
+ let __stryke_path_append = require("@stryke/path/append");
6
+ let __stryke_path_join = require("@stryke/path/join");
7
+ let defu = require("defu");
8
+ let stylelint = require("stylelint");
9
+ stylelint = require_rolldown_runtime.__toESM(stylelint);
10
+
11
+ //#region src/index.ts
12
+ /**
13
+ * A Powerlines plugin to assist in linting stylesheets with Stylelint.
14
+ */
15
+ function plugin(options = {}) {
16
+ return {
17
+ name: "stylelint",
18
+ async config() {
19
+ this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `stylelint` build plugin.");
20
+ return { lint: { stylelint: (0, defu.defu)(options, {
21
+ configFile: (0, __stryke_fs_get_parent_path.getParentPath)([
22
+ "stylelint.config.js",
23
+ "stylelint.config.mjs",
24
+ "stylelint.config.cjs",
25
+ "stylelint.config.ts",
26
+ "stylelint.config.mts",
27
+ "stylelint.config.cts",
28
+ ".stylelintrc.js",
29
+ ".stylelintrc.cjs",
30
+ ".stylelintrc.yaml",
31
+ ".stylelintrc.yml",
32
+ ".stylelintrc.json",
33
+ ".stylelintrc"
34
+ ], this.config.projectRoot, {
35
+ ignoreCase: true,
36
+ skipCwd: false,
37
+ includeNameInResults: true
38
+ }),
39
+ cwd: (0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot),
40
+ silent: this.config.logLevel !== null,
41
+ fix: true
42
+ }) } };
43
+ },
44
+ async lint() {
45
+ this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Linting project files with Stylelint.`);
46
+ const result = await stylelint.default.lint(options);
47
+ if (this.config.lint.stylelint.outputFile) await this.fs.write((0, __stryke_path_append.appendPath)(this.config.lint.stylelint.outputFile, this.config.projectRoot), result.report);
48
+ if (!this.config.lint.stylelint.silent) {
49
+ this.log(__storm_software_config_tools_types.LogLevelLabel.INFO, result.report);
50
+ const totalWarnings = result.results.map((res) => res.warnings.filter((warn) => warn.severity === "warning")).reduce((prev, res) => prev + res.length, 0);
51
+ if (totalWarnings > 0) this.log(__storm_software_config_tools_types.LogLevelLabel.WARN, `${totalWarnings} Stylelint linting warnings found in the listed files.`);
52
+ else if (result.errored) this.log(__storm_software_config_tools_types.LogLevelLabel.ERROR, "Stylelint linting errors found in the listed files.");
53
+ else this.log(__storm_software_config_tools_types.LogLevelLabel.INFO, "All files pass Stylelint linting.");
54
+ }
55
+ }
56
+ };
57
+ }
58
+ var src_default = plugin;
59
+
60
+ //#endregion
61
+ exports.default = src_default;
62
+ exports.plugin = plugin;
package/dist/index.mjs CHANGED
@@ -1 +1,58 @@
1
- import{LogLevelLabel as e}from"@storm-software/config-tools/types";import{getParentPath as t}from"@stryke/fs/get-parent-path";import{appendPath as n}from"@stryke/path/append";import{joinPaths as r}from"@stryke/path/join";import{defu as i}from"defu";import a from"stylelint";function o(o={}){return{name:`stylelint`,async config(){return this.log(e.TRACE,"Providing default configuration for the Powerlines `stylelint` build plugin."),{lint:{stylelint:i(o,{configFile:t([`stylelint.config.js`,`stylelint.config.mjs`,`stylelint.config.cjs`,`stylelint.config.ts`,`stylelint.config.mts`,`stylelint.config.cts`,`.stylelintrc.js`,`.stylelintrc.cjs`,`.stylelintrc.yaml`,`.stylelintrc.yml`,`.stylelintrc.json`,`.stylelintrc`],this.config.projectRoot,{ignoreCase:!0,skipCwd:!1,includeNameInResults:!0}),cwd:r(this.workspaceConfig.workspaceRoot,this.config.projectRoot),silent:this.config.logLevel!==null,fix:!0})}}},async lint(){this.log(e.TRACE,`Linting project files with Stylelint.`);let t=await a.lint(o);if(this.config.lint.stylelint.outputFile&&await this.fs.write(n(this.config.lint.stylelint.outputFile,this.config.projectRoot),t.report),!this.config.lint.stylelint.silent){this.log(e.INFO,t.report);let n=t.results.map(e=>e.warnings.filter(e=>e.severity===`warning`)).reduce((e,t)=>e+t.length,0);n>0?this.log(e.WARN,`${n} Stylelint linting warnings found in the listed files.`):t.errored?this.log(e.ERROR,`Stylelint linting errors found in the listed files.`):this.log(e.INFO,`All files pass Stylelint linting.`)}}}}var s=o;export{s as default,o as plugin};
1
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
2
+ import { getParentPath } from "@stryke/fs/get-parent-path";
3
+ import { appendPath } from "@stryke/path/append";
4
+ import { joinPaths } from "@stryke/path/join";
5
+ import { defu } from "defu";
6
+ import stylelint from "stylelint";
7
+
8
+ //#region src/index.ts
9
+ /**
10
+ * A Powerlines plugin to assist in linting stylesheets with Stylelint.
11
+ */
12
+ function plugin(options = {}) {
13
+ return {
14
+ name: "stylelint",
15
+ async config() {
16
+ this.log(LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `stylelint` build plugin.");
17
+ return { lint: { stylelint: defu(options, {
18
+ configFile: getParentPath([
19
+ "stylelint.config.js",
20
+ "stylelint.config.mjs",
21
+ "stylelint.config.cjs",
22
+ "stylelint.config.ts",
23
+ "stylelint.config.mts",
24
+ "stylelint.config.cts",
25
+ ".stylelintrc.js",
26
+ ".stylelintrc.cjs",
27
+ ".stylelintrc.yaml",
28
+ ".stylelintrc.yml",
29
+ ".stylelintrc.json",
30
+ ".stylelintrc"
31
+ ], this.config.projectRoot, {
32
+ ignoreCase: true,
33
+ skipCwd: false,
34
+ includeNameInResults: true
35
+ }),
36
+ cwd: joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot),
37
+ silent: this.config.logLevel !== null,
38
+ fix: true
39
+ }) } };
40
+ },
41
+ async lint() {
42
+ this.log(LogLevelLabel.TRACE, `Linting project files with Stylelint.`);
43
+ const result = await stylelint.lint(options);
44
+ if (this.config.lint.stylelint.outputFile) await this.fs.write(appendPath(this.config.lint.stylelint.outputFile, this.config.projectRoot), result.report);
45
+ if (!this.config.lint.stylelint.silent) {
46
+ this.log(LogLevelLabel.INFO, result.report);
47
+ const totalWarnings = result.results.map((res) => res.warnings.filter((warn) => warn.severity === "warning")).reduce((prev, res) => prev + res.length, 0);
48
+ if (totalWarnings > 0) this.log(LogLevelLabel.WARN, `${totalWarnings} Stylelint linting warnings found in the listed files.`);
49
+ else if (result.errored) this.log(LogLevelLabel.ERROR, "Stylelint linting errors found in the listed files.");
50
+ else this.log(LogLevelLabel.INFO, "All files pass Stylelint linting.");
51
+ }
52
+ }
53
+ };
54
+ }
55
+ var src_default = plugin;
56
+
57
+ //#endregion
58
+ 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,7 @@ 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>;
304
328
  /**
305
329
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
306
330
  *
@@ -309,7 +333,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
309
333
  * @param path - An optional path to write the builtin file to
310
334
  * @param options - Additional options for writing the builtin file
311
335
  */
312
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
336
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
313
337
  /**
314
338
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
315
339
  *
@@ -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,7 @@ 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>;
306
330
  /**
307
331
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
308
332
  *
@@ -311,7 +335,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
311
335
  * @param path - An optional path to write the builtin file to
312
336
  * @param options - Additional options for writing the builtin file
313
337
  */
314
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
338
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
315
339
  /**
316
340
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
317
341
  *
@@ -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-stylelint",
3
- "version": "0.1.121",
3
+ "version": "0.1.122",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for running Stylelint on the codebase.",
6
6
  "repository": {
@@ -106,17 +106,17 @@
106
106
  ],
107
107
  "dependencies": {
108
108
  "@storm-software/config-tools": "^1.188.74",
109
- "@stryke/fs": "^0.33.26",
110
- "@stryke/path": "^0.24.0",
109
+ "@stryke/fs": "^0.33.27",
110
+ "@stryke/path": "^0.24.1",
111
111
  "defu": "^6.1.4",
112
- "powerlines": "^0.36.22",
112
+ "powerlines": "^0.36.23",
113
113
  "stylelint": "^16.26.1"
114
114
  },
115
115
  "devDependencies": {
116
- "@powerlines/nx": "^0.11.48",
116
+ "@powerlines/nx": "^0.11.49",
117
117
  "@storm-software/tsup": "^0.2.72",
118
118
  "@types/node": "^24.10.4"
119
119
  },
120
120
  "publishConfig": { "access": "public" },
121
- "gitHead": "f88fe8eb30f96536b83fc9af884972d48e31e63a"
121
+ "gitHead": "be47e546b48b9a82e460b5c5d4f02fb66e821f18"
122
122
  }