@powerlines/plugin-stylelint 0.1.120 → 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,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-stylelint",
3
- "version": "0.1.120",
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.21",
112
+ "powerlines": "^0.36.23",
113
113
  "stylelint": "^16.26.1"
114
114
  },
115
115
  "devDependencies": {
116
- "@powerlines/nx": "^0.11.47",
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": "b16324cf857ea5743fd7ad06e18607b1ba32abe0"
121
+ "gitHead": "be47e546b48b9a82e460b5c5d4f02fb66e821f18"
122
122
  }