eslint-plugin-better-stylelint 2.0.4 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -30,9 +30,9 @@ interface BetterStylelintProcessor {
30
30
  type BetterStylelintRuleOptions = BetterStylelintOptions;
31
31
  //#endregion
32
32
  //#region src/processor.d.ts
33
- declare function createStylelintProcessor(options?: BetterStylelintRuleOptions): BetterStylelintProcessor;
34
- declare const cssProcessor: BetterStylelintProcessor;
35
- declare const scssProcessor: BetterStylelintProcessor;
33
+ export declare function createStylelintProcessor(options?: BetterStylelintRuleOptions): BetterStylelintProcessor;
34
+ export declare const cssProcessor: BetterStylelintProcessor;
35
+ export declare const scssProcessor: BetterStylelintProcessor;
36
36
  //#endregion
37
37
  //#region src/rule.d.ts
38
38
  interface RuleContext {
@@ -55,7 +55,7 @@ interface RuleContext {
55
55
  text: string;
56
56
  };
57
57
  }
58
- declare const lintRule: {
58
+ export declare const lintRule: {
59
59
  meta: {
60
60
  type: string;
61
61
  docs: {
@@ -86,7 +86,7 @@ declare const lintRule: {
86
86
  };
87
87
  //#endregion
88
88
  //#region src/core.d.ts
89
- declare function runStylelintSync(code: string, filename: string, options?: BetterStylelintOptions | string): BetterStylelintMessage[];
89
+ export declare function runStylelintSync(code: string, filename: string, options?: BetterStylelintOptions | string): BetterStylelintMessage[];
90
90
  //#endregion
91
91
  //#region src/index.d.ts
92
92
  interface BetterStylelintPlugin {
@@ -104,4 +104,4 @@ interface BetterStylelintPlugin {
104
104
  }
105
105
  declare const plugin: BetterStylelintPlugin;
106
106
  //#endregion
107
- export { type BetterStylelintConfig, type BetterStylelintMessage, type BetterStylelintOptions, type BetterStylelintProcessor, type BetterStylelintRuleOptions, createStylelintProcessor, cssProcessor, plugin as default, lintRule, runStylelintSync, scssProcessor };
107
+ export { type BetterStylelintConfig, type BetterStylelintMessage, type BetterStylelintOptions, type BetterStylelintProcessor, type BetterStylelintRuleOptions, plugin as default };
package/dist/index.js CHANGED
@@ -1,20 +1,14 @@
1
- import { createRequire } from "node:module";
2
1
  import { execFileSync } from "node:child_process";
3
2
  import { createHash } from "node:crypto";
4
- import fs from "node:fs";
5
- import os from "node:os";
6
3
  import path from "node:path";
7
4
  import process from "node:process";
8
- import { fileURLToPath, pathToFileURL } from "node:url";
5
+ import { fileURLToPath } from "node:url";
9
6
  //#region src/core.ts
10
7
  const MAX_CACHE_ENTRIES = 100;
11
- const CORE_TS_PATTERN = /core\.ts$/u;
12
8
  const CORE_JS_PATTERN = /core\.js$/u;
13
- const WORKER_BOOTSTRAP_PREFIX = "icebreaker-stylelint-worker-";
14
9
  const resultCache = /* @__PURE__ */ new Map();
15
10
  const configCacheIds = /* @__PURE__ */ new WeakMap();
16
11
  let nextConfigCacheId = 0;
17
- const require = createRequire(import.meta.url);
18
12
  const UNSUPPORTED_EXEC_ARGV_FLAGS = /* @__PURE__ */ new Set([
19
13
  "--eval",
20
14
  "-e",
@@ -86,7 +80,7 @@ function setCachedMessages(cacheKey, messages) {
86
80
  }
87
81
  function resolveWorkerPath() {
88
82
  const currentFilePath = fileURLToPath(import.meta.url);
89
- if (currentFilePath.endsWith(".ts")) return currentFilePath.replace(CORE_TS_PATTERN, "worker.ts");
83
+ if (currentFilePath.endsWith(".ts")) return path.resolve(path.dirname(currentFilePath), "../dist/worker.js");
90
84
  return currentFilePath.replace(CORE_JS_PATTERN, "worker.js");
91
85
  }
92
86
  function getWorkerExecArgv() {
@@ -107,21 +101,6 @@ function getWorkerExecArgv() {
107
101
  return workerExecArgv;
108
102
  }
109
103
  function resolveWorkerCommand(workerPath) {
110
- if (workerPath.endsWith(".ts")) {
111
- const workerEntry = pathToFileURL(workerPath).href;
112
- const tsxLoaderEntry = pathToFileURL(require.resolve("tsx/esm")).href;
113
- const bootstrapPath = path.join(os.tmpdir(), `${WORKER_BOOTSTRAP_PREFIX}${createHash("sha1").update(workerEntry).digest("hex")}.mjs`);
114
- if (!fs.existsSync(bootstrapPath)) fs.writeFileSync(bootstrapPath, `import ${JSON.stringify(workerEntry)}\n`, "utf8");
115
- return {
116
- command: process.execPath,
117
- args: [
118
- ...getWorkerExecArgv(),
119
- "--import",
120
- tsxLoaderEntry,
121
- bootstrapPath
122
- ]
123
- };
124
- }
125
104
  return {
126
105
  command: process.execPath,
127
106
  args: [...getWorkerExecArgv(), workerPath]
package/dist/worker.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from "node:module";
2
- import fs from "node:fs";
3
2
  import path from "node:path";
4
3
  import process from "node:process";
5
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
+ import fs from "node:fs";
6
6
  //#region src/worker.ts
7
7
  function normalizeWarning(warning) {
8
8
  return {
@@ -45,7 +45,8 @@ function resolveStylelintEntry(cwd) {
45
45
  }
46
46
  async function runStylelint(code, filename, options) {
47
47
  try {
48
- const stylelintModule = await import(pathToFileURL(resolveStylelintEntry(options.cwd)).href);
48
+ const stylelintEntry = resolveStylelintEntry(options.cwd);
49
+ const stylelintModule = await import(pathToFileURL(stylelintEntry).href);
49
50
  const stylelint = stylelintModule.default ?? stylelintModule;
50
51
  const config = await resolveStylelintConfig(options);
51
52
  return {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "eslint-plugin-better-stylelint",
3
3
  "type": "module",
4
- "version": "2.0.4",
4
+ "version": "2.1.0",
5
5
  "description": "Bridge Stylelint diagnostics into ESLint for style files and Vue SFCs",
6
- "author": "ice breaker <1324318532@qq.com>",
6
+ "author": "ice breaker <hi@sonofmagic.top>",
7
7
  "license": "MIT",
8
8
  "homepage": "https://repoctl.icebreaker.top",
9
9
  "repository": {
@@ -36,11 +36,11 @@
36
36
  "dist"
37
37
  ],
38
38
  "engines": {
39
- "node": ">=22.12.0"
39
+ "node": ">=22.13.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "eslint": "^9.0.0 || ^10.0.0",
43
- "stylelint": "^17.14.1"
43
+ "stylelint": "^17.15.0"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "stylelint": {
@@ -48,7 +48,7 @@
48
48
  }
49
49
  },
50
50
  "dependencies": {
51
- "stylelint": "^17.14.1"
51
+ "stylelint": "^17.15.0"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public",