@powerlines/plugin-stylelint 0.1.121 → 0.1.123
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/_virtual/rolldown_runtime.cjs +29 -1
- package/dist/index.cjs +62 -1
- package/dist/index.mjs +58 -1
- package/dist/powerlines/src/types/context.d.cts +27 -3
- package/dist/powerlines/src/types/context.d.mts +27 -3
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +8 -8
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
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
|
|
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
|
|
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 =
|
|
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?:
|
|
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?:
|
|
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 =
|
|
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?:
|
|
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?:
|
|
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
|
*
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "0.1.123",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin for running Stylelint on the codebase.",
|
|
6
6
|
"repository": {
|
|
@@ -105,18 +105,18 @@
|
|
|
105
105
|
"powerlines-plugin"
|
|
106
106
|
],
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"@storm-software/config-tools": "^1.188.
|
|
109
|
-
"@stryke/fs": "^0.33.
|
|
110
|
-
"@stryke/path": "^0.24.
|
|
108
|
+
"@storm-software/config-tools": "^1.188.75",
|
|
109
|
+
"@stryke/fs": "^0.33.27",
|
|
110
|
+
"@stryke/path": "^0.24.1",
|
|
111
111
|
"defu": "^6.1.4",
|
|
112
|
-
"powerlines": "^0.36.
|
|
112
|
+
"powerlines": "^0.36.24",
|
|
113
113
|
"stylelint": "^16.26.1"
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
|
-
"@powerlines/nx": "^0.11.
|
|
117
|
-
"@storm-software/tsup": "^0.2.
|
|
116
|
+
"@powerlines/nx": "^0.11.50",
|
|
117
|
+
"@storm-software/tsup": "^0.2.73",
|
|
118
118
|
"@types/node": "^24.10.4"
|
|
119
119
|
},
|
|
120
120
|
"publishConfig": { "access": "public" },
|
|
121
|
-
"gitHead": "
|
|
121
|
+
"gitHead": "4b695d4b3476fd9dd79521f92258d52dab2b8d72"
|
|
122
122
|
}
|