@salesforce-ux/slds-linter 0.2.0-alpha.6 → 0.2.1

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.
Files changed (49) hide show
  1. package/build/commands/emit.js +0 -1
  2. package/build/commands/lint.js +0 -1
  3. package/build/commands/report.js +0 -1
  4. package/build/executor/__tests__/executor.test.js +28 -2
  5. package/build/executor/index.js +28 -2
  6. package/build/index.js +1 -2
  7. package/build/services/__tests__/file-scanner.test.js +0 -1
  8. package/build/services/artifact-processor.js +0 -1
  9. package/build/services/batch-processor.js +0 -1
  10. package/build/services/config.resolver.js +1 -2
  11. package/build/services/file-patterns.js +0 -1
  12. package/build/services/file-scanner.js +0 -1
  13. package/build/services/lint-runner.js +0 -1
  14. package/build/services/report-generator.js +0 -1
  15. package/build/types/index.js +0 -1
  16. package/build/utils/config-utils.js +0 -1
  17. package/build/utils/editorLinkUtil.js +0 -1
  18. package/build/utils/index.d.ts +2 -0
  19. package/build/utils/index.js +7 -0
  20. package/build/utils/lintResultsUtil.js +0 -1
  21. package/build/utils/logger.js +0 -1
  22. package/build/utils/nodeVersionUtil.js +0 -1
  23. package/build/workers/base.worker.js +0 -1
  24. package/build/workers/eslint.worker.js +0 -1
  25. package/build/workers/stylelint.worker.js +0 -1
  26. package/package.json +8 -4
  27. package/build/commands/emit.js.map +0 -7
  28. package/build/commands/lint.js.map +0 -7
  29. package/build/commands/report.js.map +0 -7
  30. package/build/executor/__tests__/executor.test.js.map +0 -7
  31. package/build/executor/index.js.map +0 -7
  32. package/build/index.js.map +0 -7
  33. package/build/services/__tests__/file-scanner.test.js.map +0 -7
  34. package/build/services/artifact-processor.js.map +0 -7
  35. package/build/services/batch-processor.js.map +0 -7
  36. package/build/services/config.resolver.js.map +0 -7
  37. package/build/services/file-patterns.js.map +0 -7
  38. package/build/services/file-scanner.js.map +0 -7
  39. package/build/services/lint-runner.js.map +0 -7
  40. package/build/services/report-generator.js.map +0 -7
  41. package/build/types/index.js.map +0 -7
  42. package/build/utils/config-utils.js.map +0 -7
  43. package/build/utils/editorLinkUtil.js.map +0 -7
  44. package/build/utils/lintResultsUtil.js.map +0 -7
  45. package/build/utils/logger.js.map +0 -7
  46. package/build/utils/nodeVersionUtil.js.map +0 -7
  47. package/build/workers/base.worker.js.map +0 -7
  48. package/build/workers/eslint.worker.js.map +0 -7
  49. package/build/workers/stylelint.worker.js.map +0 -7
@@ -46,4 +46,3 @@ ${destESLintConfigPath}
46
46
  export {
47
47
  registerEmitCommand
48
48
  };
49
- //# sourceMappingURL=emit.js.map
@@ -53,4 +53,3 @@ Linting completed in ${elapsedTime} seconds.`));
53
53
  export {
54
54
  registerLintCommand
55
55
  };
56
- //# sourceMappingURL=lint.js.map
@@ -64,4 +64,3 @@ function registerReportCommand(program) {
64
64
  export {
65
65
  registerReportCommand
66
66
  };
67
- //# sourceMappingURL=report.js.map
@@ -58,7 +58,7 @@ async function lint(config) {
58
58
  configPath: normalizedConfig.configEslint
59
59
  });
60
60
  const combinedResults = [...styleResults, ...componentResults];
61
- return combinedResults;
61
+ return standardizeLintMessages(combinedResults);
62
62
  } catch (error) {
63
63
  const errorMessage = `Linting failed: ${error.message}`;
64
64
  Logger.error(errorMessage);
@@ -98,6 +98,33 @@ async function report(config, results) {
98
98
  throw new Error(errorMessage);
99
99
  }
100
100
  }
101
+ function standardizeLintMessages(results) {
102
+ return results.map((result) => ({
103
+ ...result,
104
+ errors: result.errors.map((entry) => {
105
+ let msgObj;
106
+ try {
107
+ msgObj = JSON.parse(entry.message);
108
+ if (typeof msgObj === "object" && "message" in msgObj) {
109
+ return { ...entry, ...msgObj };
110
+ }
111
+ } catch {
112
+ }
113
+ return { ...entry, message: entry.message };
114
+ }),
115
+ warnings: result.warnings.map((entry) => {
116
+ let msgObj;
117
+ try {
118
+ msgObj = JSON.parse(entry.message);
119
+ if (typeof msgObj === "object" && "message" in msgObj) {
120
+ return { ...entry, ...msgObj };
121
+ }
122
+ } catch {
123
+ }
124
+ return { ...entry, message: entry.message };
125
+ })
126
+ }));
127
+ }
101
128
  var init_executor = __esm({
102
129
  "src/executor/index.ts"() {
103
130
  }
@@ -187,4 +214,3 @@ describe("Executor placeholder tests", () => {
187
214
  expect(true).toBe(true);
188
215
  });
189
216
  });
190
- //# sourceMappingURL=executor.test.js.map
@@ -32,7 +32,7 @@ async function lint(config) {
32
32
  configPath: normalizedConfig.configEslint
33
33
  });
34
34
  const combinedResults = [...styleResults, ...componentResults];
35
- return combinedResults;
35
+ return standardizeLintMessages(combinedResults);
36
36
  } catch (error) {
37
37
  const errorMessage = `Linting failed: ${error.message}`;
38
38
  Logger.error(errorMessage);
@@ -72,8 +72,34 @@ async function report(config, results) {
72
72
  throw new Error(errorMessage);
73
73
  }
74
74
  }
75
+ function standardizeLintMessages(results) {
76
+ return results.map((result) => ({
77
+ ...result,
78
+ errors: result.errors.map((entry) => {
79
+ let msgObj;
80
+ try {
81
+ msgObj = JSON.parse(entry.message);
82
+ if (typeof msgObj === "object" && "message" in msgObj) {
83
+ return { ...entry, ...msgObj };
84
+ }
85
+ } catch {
86
+ }
87
+ return { ...entry, message: entry.message };
88
+ }),
89
+ warnings: result.warnings.map((entry) => {
90
+ let msgObj;
91
+ try {
92
+ msgObj = JSON.parse(entry.message);
93
+ if (typeof msgObj === "object" && "message" in msgObj) {
94
+ return { ...entry, ...msgObj };
95
+ }
96
+ } catch {
97
+ }
98
+ return { ...entry, message: entry.message };
99
+ })
100
+ }));
101
+ }
75
102
  export {
76
103
  lint,
77
104
  report
78
105
  };
79
- //# sourceMappingURL=index.js.map
package/build/index.js CHANGED
@@ -19,7 +19,7 @@ process.on("uncaughtException", (error) => {
19
19
  var program = new Command();
20
20
  program.name("npx @salesforce-ux/slds-linter@latest").showHelpAfterError();
21
21
  function registerVersion() {
22
- program.description("SLDS Linter CLI tool for linting styles and components").version("0.2.0-alpha.5");
22
+ program.description("SLDS Linter CLI tool for linting styles and components").version("0.2.1");
23
23
  }
24
24
  registerLintCommand(program);
25
25
  registerReportCommand(program);
@@ -31,4 +31,3 @@ program.configureHelp({
31
31
  }
32
32
  });
33
33
  program.parse(process.argv);
34
- //# sourceMappingURL=index.js.map
@@ -45,4 +45,3 @@ describe("FileScanner", () => {
45
45
  expect(batches).toHaveLength(0);
46
46
  });
47
47
  });
48
- //# sourceMappingURL=file-scanner.test.js.map
@@ -35,4 +35,3 @@ async function processArtifacts(artifacts) {
35
35
  export {
36
36
  processArtifacts
37
37
  };
38
- //# sourceMappingURL=artifact-processor.js.map
@@ -82,4 +82,3 @@ var BatchProcessor = class {
82
82
  export {
83
83
  BatchProcessor
84
84
  };
85
- //# sourceMappingURL=batch-processor.js.map
@@ -5,7 +5,7 @@ var DEFAULT_ESLINT_CONFIG_PATH = resolvePath("@salesforce-ux/eslint-plugin-slds/
5
5
  var DEFAULT_STYLELINT_CONFIG_PATH = resolvePath("@salesforce-ux/stylelint-plugin-slds/.stylelintrc.yml", import.meta);
6
6
  var STYLELINT_VERSION = "16.14.1";
7
7
  var ESLINT_VERSION = "8.57.1";
8
- var LINTER_CLI_VERSION = "0.2.0-alpha.5";
8
+ var LINTER_CLI_VERSION = "0.2.1";
9
9
  var getRuleDescription = (ruleId) => {
10
10
  const ruleIdWithoutNameSpace = `${ruleId}`.replace(/\@salesforce-ux\//, "");
11
11
  return ruleMetadata(ruleIdWithoutNameSpace)?.ruleDesc || "--";
@@ -18,4 +18,3 @@ export {
18
18
  STYLELINT_VERSION,
19
19
  getRuleDescription
20
20
  };
21
- //# sourceMappingURL=config.resolver.js.map
@@ -19,4 +19,3 @@ export {
19
19
  ComponentFilePatterns,
20
20
  StyleFilePatterns
21
21
  };
22
- //# sourceMappingURL=file-patterns.js.map
@@ -69,4 +69,3 @@ var FileScanner = class {
69
69
  export {
70
70
  FileScanner
71
71
  };
72
- //# sourceMappingURL=file-scanner.js.map
@@ -67,4 +67,3 @@ var LintRunner = class {
67
67
  export {
68
68
  LintRunner
69
69
  };
70
- //# sourceMappingURL=lint-runner.js.map
@@ -184,4 +184,3 @@ export {
184
184
  CsvReportGenerator,
185
185
  ReportGenerator
186
186
  };
187
- //# sourceMappingURL=report-generator.js.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=index.js.map
@@ -66,4 +66,3 @@ export {
66
66
  normalizeConfig,
67
67
  normalizeDirectoryPath
68
68
  };
69
- //# sourceMappingURL=config-utils.js.map
@@ -19,4 +19,3 @@ export {
19
19
  createClickableLineCol,
20
20
  getEditorLink
21
21
  };
22
- //# sourceMappingURL=editorLinkUtil.js.map
@@ -0,0 +1,2 @@
1
+ export { printLintResults } from './lintResultsUtil';
2
+ export { Logger } from './logger';
@@ -0,0 +1,7 @@
1
+ // src/utils/index.ts
2
+ import { printLintResults } from "./lintResultsUtil.js";
3
+ import { Logger } from "./logger.js";
4
+ export {
5
+ Logger,
6
+ printLintResults
7
+ };
@@ -68,4 +68,3 @@ export {
68
68
  replaceNamespaceinRules,
69
69
  transformedResults
70
70
  };
71
- //# sourceMappingURL=lintResultsUtil.js.map
@@ -26,4 +26,3 @@ var Logger = class {
26
26
  export {
27
27
  Logger
28
28
  };
29
- //# sourceMappingURL=logger.js.map
@@ -40,4 +40,3 @@ export {
40
40
  resolvePath,
41
41
  validateNodeVersion
42
42
  };
43
- //# sourceMappingURL=nodeVersionUtil.js.map
@@ -42,4 +42,3 @@ var BaseWorker = class {
42
42
  export {
43
43
  BaseWorker
44
44
  };
45
- //# sourceMappingURL=base.worker.js.map
@@ -48,4 +48,3 @@ worker.process().catch((error) => {
48
48
  console.error("Worker failed:", error);
49
49
  process.exit(1);
50
50
  });
51
- //# sourceMappingURL=eslint.worker.js.map
@@ -38,4 +38,3 @@ worker.process().catch((error) => {
38
38
  console.error("Worker failed:", error);
39
39
  process.exit(1);
40
40
  });
41
- //# sourceMappingURL=stylelint.worker.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce-ux/slds-linter",
3
- "version": "0.2.0-alpha.6",
3
+ "version": "0.2.1",
4
4
  "description": "SLDS Linter CLI tool for linting styles and components",
5
5
  "keywords": [
6
6
  "lightning design system linter",
@@ -17,16 +17,20 @@
17
17
  "./executor": {
18
18
  "types": "./build/executor/index.d.ts",
19
19
  "default": "./build/executor/index.js"
20
+ },
21
+ "./utils": {
22
+ "types": "./build/utils/index.d.ts",
23
+ "default": "./build/utils/index.js"
20
24
  }
21
25
  },
22
26
  "files": [
23
27
  "build/**",
24
28
  "README.md"
25
29
  ],
26
- "bin": "./build/index.js",
30
+ "bin": "build/index.js",
27
31
  "dependencies": {
28
- "@salesforce-ux/eslint-plugin-slds": "0.2.0-alpha.6",
29
- "@salesforce-ux/stylelint-plugin-slds": "0.2.0-alpha.6",
32
+ "@salesforce-ux/eslint-plugin-slds": "0.2.1",
33
+ "@salesforce-ux/stylelint-plugin-slds": "0.2.1",
30
34
  "@typescript-eslint/eslint-plugin": "^5.0.0",
31
35
  "@typescript-eslint/parser": "^5.0.0",
32
36
  "chalk": "^4.1.2",
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/commands/emit.ts"],
4
- "sourcesContent": ["import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { CliOptions } from \"../types\";\nimport { Logger } from \"../utils/logger\";\nimport { normalizeCliOptions } from '../utils/config-utils';\nimport {\n DEFAULT_ESLINT_CONFIG_PATH,\n DEFAULT_STYLELINT_CONFIG_PATH,\n} from \"../services/config.resolver\";\nimport path from \"path\";\nimport { copyFile } from 'fs/promises';\n\nexport function registerEmitCommand(program: Command): void {\n program\n .command(\"emit\")\n .description(\"Emits the configuration files used by slds-linter cli\")\n .option(\n \"-d, --directory <path>\",\n \"Target directory to emit (defaults to current directory). Support glob patterns\"\n )\n .action(async (options: CliOptions) => {\n try {\n Logger.info(chalk.blue(\"Emitting configuration files...\"));\n const normalizedOptions = normalizeCliOptions(options, {\n configStylelint: DEFAULT_STYLELINT_CONFIG_PATH,\n configEslint: DEFAULT_ESLINT_CONFIG_PATH,\n });\n\n const destStyleConfigPath = path.join(\n normalizedOptions.directory,\n path.basename(normalizedOptions.configStylelint)\n );\n await copyFile(normalizedOptions.configStylelint, destStyleConfigPath);\n Logger.success(chalk.green(`Stylelint configuration created at:\\n${destStyleConfigPath}\\n`));\n\n const destESLintConfigPath = path.join(\n normalizedOptions.directory,\n path.basename(normalizedOptions.configEslint)\n );\n await copyFile(normalizedOptions.configEslint, destESLintConfigPath);\n Logger.success(chalk.green(`ESLint configuration created at:\\n${destESLintConfigPath}\\n`));\n } catch (error: any) {\n Logger.error(\n chalk.red(`Failed to emit configuration: ${error.message}`)\n );\n process.exit(1);\n }\n });\n}\n"],
5
- "mappings": ";AACA,OAAO,WAAW;AAElB,SAAS,cAAc;AACvB,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,OAAO,UAAU;AACjB,SAAS,gBAAgB;AAElB,SAAS,oBAAoB,SAAwB;AAC1D,UACG,QAAQ,MAAM,EACd,YAAY,uDAAuD,EACnE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,OAAO,YAAwB;AACrC,QAAI;AACF,aAAO,KAAK,MAAM,KAAK,iCAAiC,CAAC;AACzD,YAAM,oBAAoB,oBAAoB,SAAS;AAAA,QACrD,iBAAiB;AAAA,QACjB,cAAc;AAAA,MAChB,CAAC;AAED,YAAM,sBAAsB,KAAK;AAAA,QAC/B,kBAAkB;AAAA,QAClB,KAAK,SAAS,kBAAkB,eAAe;AAAA,MACjD;AACA,YAAM,SAAS,kBAAkB,iBAAiB,mBAAmB;AACrE,aAAO,QAAQ,MAAM,MAAM;AAAA,EAAwC,mBAAmB;AAAA,CAAI,CAAC;AAE3F,YAAM,uBAAuB,KAAK;AAAA,QAChC,kBAAkB;AAAA,QAClB,KAAK,SAAS,kBAAkB,YAAY;AAAA,MAC9C;AACA,YAAM,SAAS,kBAAkB,cAAc,oBAAoB;AACnE,aAAO,QAAQ,MAAM,MAAM;AAAA,EAAqC,oBAAoB;AAAA,CAAI,CAAC;AAAA,IAC3F,SAAS,OAAY;AACnB,aAAO;AAAA,QACL,MAAM,IAAI,iCAAiC,MAAM,OAAO,EAAE;AAAA,MAC5D;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/commands/lint.ts"],
4
- "sourcesContent": ["import { Command, Option } from 'commander';\nimport chalk from 'chalk';\nimport { CliOptions } from '../types';\nimport { printLintResults } from '../utils/lintResultsUtil';\nimport { normalizeCliOptions, normalizeDirectoryPath } from '../utils/config-utils';\nimport { Logger } from '../utils/logger';\nimport { DEFAULT_ESLINT_CONFIG_PATH, DEFAULT_STYLELINT_CONFIG_PATH } from '../services/config.resolver';\nimport { lint } from '../executor';\n\nexport function registerLintCommand(program: Command): void {\n program\n .command('lint')\n .aliases(['lint:styles', 'lint:components'])\n .configureHelp({\n commandUsage: ()=>{\n return `${program.name()} lint [directory] [options]`\n }\n })\n .description('Run both style and component linting')\n .argument('[directory]', 'Target directory to scan (defaults to current directory). Support glob patterns')\n .addOption(new Option('-d, --directory <path>', 'Target directory to scan (defaults to current directory). Support glob patterns').hideHelp())\n .option('--fix', 'Automatically fix problems')\n .option('--config-stylelint <path>', 'Path to stylelint config file')\n .option('--config-eslint <path>', 'Path to eslint config file')\n .option('--editor <editor>', 'Editor to open files with (e.g., vscode, atom, sublime). Defaults to vscode', 'vscode')\n .action(async (directory:string, options: CliOptions) => {\n const startTime = Date.now();\n try {\n Logger.info(chalk.blue('Starting lint process...'));\n // Parse CLI options with appropriate defaults\n const normalizedOptions = normalizeCliOptions(options, {\n configStylelint: DEFAULT_STYLELINT_CONFIG_PATH,\n configEslint: DEFAULT_ESLINT_CONFIG_PATH,\n });\n\n if(directory){ // If argument is passed, ignore -d, --directory option\n normalizedOptions.directory = normalizeDirectoryPath(directory);\n } else if(options.directory){\n // If -d, --directory option is passed, prompt deprecation warning\n Logger.newLine().warning(chalk.yellow(\n `WARNING: --directory, -d option is deprecated. Supply as argument instead.\n Example: npx @salesforce-ux/slds-linter lint ${options.directory}`\n ));\n }\n\n // Use Node API to perform the linting\n const lintResults = await lint({\n directory: normalizedOptions.directory,\n fix: normalizedOptions.fix,\n configStylelint: normalizedOptions.configStylelint,\n configEslint: normalizedOptions.configEslint\n });\n\n // Print detailed lint results only for files with issues\n printLintResults(lintResults, normalizedOptions.editor);\n\n // Calculate statistics\n const errorCount = lintResults.reduce((sum, r) => sum + r.errors.length, 0);\n const warningCount = lintResults.reduce((sum, r) => sum + r.warnings.length, 0);\n\n // Final summary\n Logger.info(\n `\\n${chalk.red(`${errorCount} error${errorCount !== 1 ? 's' : ''}`)}` +\n ` ${chalk.yellow(`${warningCount} warning${warningCount !== 1 ? 's' : ''}`)}`\n );\n \n const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);\n Logger.success(chalk.green(`\\nLinting completed in ${elapsedTime} seconds.`));\n process.exit(errorCount > 0 ? 1 : 0);\n } catch (error: any) {\n Logger.error(chalk.red(`Failed to complete linting: ${error.message}`));\n process.exit(1);\n }\n });\n}\n"],
5
- "mappings": ";AAAA,SAAkB,cAAc;AAChC,OAAO,WAAW;AAElB,SAAS,wBAAwB;AACjC,SAAS,qBAAqB,8BAA8B;AAC5D,SAAS,cAAc;AACvB,SAAS,4BAA4B,qCAAqC;AAC1E,SAAS,YAAY;AAEd,SAAS,oBAAoB,SAAwB;AAC1D,UACG,QAAQ,MAAM,EACd,QAAQ,CAAC,eAAe,iBAAiB,CAAC,EAC1C,cAAc;AAAA,IACb,cAAc,MAAI;AAChB,aAAO,GAAG,QAAQ,KAAK,CAAC;AAAA,IAC1B;AAAA,EACF,CAAC,EACA,YAAY,sCAAsC,EAClD,SAAS,eAAe,iFAAiF,EACzG,UAAU,IAAI,OAAO,0BAA0B,iFAAiF,EAAE,SAAS,CAAC,EAC5I,OAAO,SAAS,4BAA4B,EAC5C,OAAO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nB,aAAO,MAAM,MAAM,IAAI,+BAA+B,MAAM,OAAO,EAAE,CAAC;AACtE,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/commands/report.ts"],
4
- "sourcesContent": ["import { Command, Option } from 'commander';\nimport path from 'path';\nimport ora from 'ora';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport { CliOptions } from '../types';\nimport { normalizeCliOptions, normalizeDirectoryPath } from '../utils/config-utils';\nimport { Logger } from '../utils/logger';\nimport { DEFAULT_ESLINT_CONFIG_PATH, DEFAULT_STYLELINT_CONFIG_PATH } from '../services/config.resolver';\nimport { report, lint } from '../executor';\n\nexport function registerReportCommand(program: Command): void {\n program\n .command('report')\n .description('Generate report from linting results')\n .argument('[directory]', 'Target directory to scan (defaults to current directory). Support glob patterns')\n .addOption(new Option('-d, --directory <path>', 'Target directory to scan (defaults to current directory). Support glob patterns').hideHelp()) \n .option('-o, --output <path>', 'Output directory for reports (defaults to current directory)')\n .option('--config-stylelint <path>', 'Path to stylelint config file')\n .option('--config-eslint <path>', 'Path to eslint config file')\n .addOption(new Option('--format <type>', 'Output format').choices(['sarif', 'csv']).default('sarif'))\n .action(async (directory: string, options: CliOptions) => {\n const spinner = ora('Starting report generation...');\n try { \n const normalizedOptions = normalizeCliOptions(options, {\n configStylelint: DEFAULT_STYLELINT_CONFIG_PATH,\n configEslint: DEFAULT_ESLINT_CONFIG_PATH\n });\n\n if(directory){ // If argument is passed, ignore -d, --directory option\n normalizedOptions.directory = normalizeDirectoryPath(directory);\n } else if(options.directory){\n // If -d, --directory option is passed, prompt deprecation warning\n Logger.newLine().warning(chalk.yellow(\n `WARNING: --directory, -d option is deprecated. Supply as argument instead.\n Example: npx @salesforce-ux/slds-linter report ${options.directory}`\n ));\n }\n spinner.start();\n \n // Generate report based on format using Node API\n const reportFormat = normalizedOptions.format?.toLowerCase() || 'sarif';\n \n // First run linting to get results\n const lintResults = await lint({\n directory: normalizedOptions.directory,\n configStylelint: normalizedOptions.configStylelint,\n configEslint: normalizedOptions.configEslint\n });\n \n // Generate report using the lint results\n const reportStream = await report({\n format: reportFormat as 'sarif' | 'csv'\n }, lintResults);\n \n // Save the report to a file\n let outputFilePath: string;\n if (reportFormat === 'sarif') {\n spinner.text = 'Saving SARIF report...';\n outputFilePath = path.join(normalizedOptions.output, 'slds-linter-report.sarif');\n } else if (reportFormat === 'csv') {\n spinner.text = 'Saving CSV report...';\n outputFilePath = path.join(normalizedOptions.output, 'slds-linter-report.csv');\n } else {\n throw new Error(`Invalid format: ${reportFormat}. Supported formats: sarif, csv`);\n }\n \n // Save stream to file\n const writeStream = fs.createWriteStream(outputFilePath);\n reportStream.pipe(writeStream);\n \n await new Promise<void>((resolve, reject) => {\n writeStream.on('finish', resolve);\n writeStream.on('error', reject);\n });\n \n Logger.success(`${reportFormat.toUpperCase()} report generated: ${outputFilePath}\\n`);\n spinner.succeed('Report generation completed');\n process.exit(0);\n } catch (error: any) {\n spinner?.fail('Report generation failed');\n Logger.error(`Failed to generate report: ${error.message}`);\n process.exit(1);\n }\n });\n}\n"],
5
- "mappings": ";AAAA,SAAkB,cAAc;AAChC,OAAO,UAAU;AACjB,OAAO,SAAS;AAChB,OAAO,WAAW;AAClB,OAAO,QAAQ;AAEf,SAAS,qBAAqB,8BAA8B;AAC5D,SAAS,cAAc;AACvB,SAAS,4BAA4B,qCAAqC;AAC1E,SAAS,QAAQ,YAAY;AAEtB,SAAS,sBAAsB,SAAwB;AAC5D,UACG,QAAQ,QAAQ,EAChB,YAAY,sCAAsC,EAClD,SAAS,eAAe,iFAAiF,EACzG,UAAU,IAAI,OAAO,0BAA0B,iFAAiF,EAAE,SAAS,CAAC,EAC5I,OAAO,uBAAuB,8DAA8D,EAC5F,OAAO,6BAA6B,+BAA+B,EACnE,OAAO,0BAA0B,4BAA4B,EAC7D,UAAU,IAAI,OAAO,mBAAm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AAAA,CAAI;AACpF,cAAQ,QAAQ,6BAA6B;AAC7C,cAAQ,KAAK,CAAC;AAAA,IAChB,SAAS,OAAY;AACnB,eAAS,KAAK,0BAA0B;AACxC,aAAO,MAAM,8BAA8B,MAAM,OAAO,EAAE;AAC1D,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/executor/index.ts", "../../../src/executor/__tests__/executor.test.ts"],
4
- "sourcesContent": ["import { Readable } from 'stream';\nimport { FileScanner } from '../services/file-scanner';\nimport { LintRunner, LintOptions } from '../services/lint-runner';\nimport { StyleFilePatterns, ComponentFilePatterns } from '../services/file-patterns';\nimport { ReportGenerator, CsvReportGenerator } from '../services/report-generator';\nimport { DEFAULT_ESLINT_CONFIG_PATH, DEFAULT_STYLELINT_CONFIG_PATH, LINTER_CLI_VERSION } from '../services/config.resolver';\nimport { LintResult, LintConfig, ReportConfig } from '../types';\nimport { normalizeCliOptions } from '../utils/config-utils';\nimport { Logger } from '../utils/logger';\n\n/**\n * Run linting on specified files or directory\n * \n * @param config Linting configuration options\n * @returns Promise resolving to an array of lint results\n * @throws Error if linting fails\n */\nexport async function lint(config: LintConfig): Promise<LintResult[]> {\n try {\n Logger.debug('Starting linting with Node API');\n \n // Normalize configuration to ensure all required fields have values\n const normalizedConfig = normalizeCliOptions(config, {}, true);\n \n // Scan directory for style files (CSS, SCSS, etc.)\n const styleFiles = await FileScanner.scanFiles(normalizedConfig.directory, {\n patterns: StyleFilePatterns,\n batchSize: 100,\n });\n \n // Scan directory for component files (HTML, etc.)\n const componentFiles = await FileScanner.scanFiles(normalizedConfig.directory, {\n patterns: ComponentFilePatterns,\n batchSize: 100,\n });\n \n // Configure linting options\n const lintOptions: LintOptions = {\n fix: normalizedConfig.fix,\n configPath: normalizedConfig.configStylelint,\n };\n \n // Run linting on style files\n const styleResults = await LintRunner.runLinting(styleFiles, 'style', {\n ...lintOptions,\n configPath: normalizedConfig.configStylelint,\n });\n \n // Run linting on component files\n const componentResults = await LintRunner.runLinting(componentFiles, 'component', {\n ...lintOptions,\n configPath: normalizedConfig.configEslint,\n });\n \n // Combine results from both linters\n const combinedResults = [...styleResults, ...componentResults];\n \n return combinedResults;\n } catch (error: any) {\n // Enhance error with context for better debugging\n const errorMessage = `Linting failed: ${error.message}`;\n Logger.error(errorMessage);\n throw new Error(errorMessage);\n }\n}\n\n/**\n * Generate a report from linting results\n * \n * @param config Report configuration options\n * @param results Optional lint results (if not provided, will run lint)\n * @returns A readable stream containing the report data\n * @throws Error if report generation fails\n */\nexport async function report(config: ReportConfig, results?: LintResult[]): Promise<Readable> {\n try {\n Logger.debug('Starting report generation with Node API');\n \n // Normalize configuration to ensure all required fields have values\n const normalizedConfig = normalizeCliOptions(config, {}, true);\n \n // Determine report format with default\n const format = normalizedConfig.format || 'sarif';\n \n // Get lint results either from provided results parameter or by running lint\n const lintResults = results || await lint({\n directory: normalizedConfig.directory,\n configStylelint: normalizedConfig.configStylelint,\n configEslint: normalizedConfig.configEslint,\n });\n \n // Process based on requested format\n switch (format) {\n case 'sarif':\n // Generate SARIF report as a stream\n return ReportGenerator.generateSarifReportStream(lintResults, {\n toolName: 'slds-linter',\n toolVersion: LINTER_CLI_VERSION\n });\n \n case 'csv':\n // Generate CSV data in memory and create a stream\n const csvString = CsvReportGenerator.generateCsvString(lintResults);\n const csvStream = new Readable();\n csvStream.push(csvString);\n csvStream.push(null); // End of stream\n return csvStream;\n \n default:\n // Throw error for unsupported formats\n const errorMessage = `Unsupported format: ${format}`;\n Logger.error(errorMessage);\n throw new Error(errorMessage);\n }\n } catch (error: any) {\n // Enhance error with context for better debugging\n const errorMessage = `Report generation failed: ${error.message}`;\n Logger.error(errorMessage);\n throw new Error(errorMessage);\n }\n}\n\nexport type { LintResult, LintResultEntry, LintConfig, ReportConfig, ExitCode, WorkerResult, SarifResultEntry } from '../types'; ", "/**\n * Tests for executor module functionality\n */\n\nimport { lint, report } from '../index';\nimport { LintConfig, ReportConfig, LintResult } from '../../types';\nimport { LintRunner } from '../../services/lint-runner';\nimport { FileScanner } from '../../services/file-scanner';\nimport { Readable } from 'stream';\nimport { jest } from '@jest/globals';\n\n// Create mock type-safe functions\nconst mockLintResult: LintResult = {\n filePath: 'file1.css',\n errors: [{ line: 1, column: 1, endColumn: 10, message: 'Test error', ruleId: 'test-rule', severity: 2 }],\n warnings: []\n};\n\n// Use an alternative approach without generic typing that was causing issues\njest.mock('../../services/lint-runner', () => {\n return {\n LintRunner: {\n runLinting: jest.fn().mockImplementation(() => {\n return Promise.resolve([mockLintResult]);\n })\n }\n };\n});\n\njest.mock('../../services/file-scanner', () => {\n return {\n FileScanner: {\n scanFiles: jest.fn().mockImplementation(() => {\n return Promise.resolve([['file1.css']]);\n })\n }\n };\n});\n\njest.mock('fs/promises');\n\n// Skip tests temporarily until TypeScript issues are resolved\nxdescribe('Executor functions', () => {\n beforeEach(() => {\n jest.clearAllMocks();\n });\n \n describe('lint', () => {\n it('should scan directory and run linting when no files are provided', async () => {\n const config: LintConfig = {\n directory: './src',\n fix: true\n };\n \n const results = await lint(config);\n \n // Check FileScanner was called with correct params\n expect(FileScanner.scanFiles).toHaveBeenCalledTimes(2);\n \n // Check LintRunner was called with correct params\n expect(LintRunner.runLinting).toHaveBeenCalledTimes(2);\n \n // Check results were combined correctly\n expect(results).toHaveLength(2);\n });\n \n it('should use provided files and skip scanning when files are provided', async () => {\n const config: LintConfig = {\n files: ['file1.css', 'component1.html']\n };\n \n await lint(config);\n \n // FileScanner should not be called when files are provided\n expect(FileScanner.scanFiles).not.toHaveBeenCalled();\n \n // LintRunner should still be called\n expect(LintRunner.runLinting).toHaveBeenCalledTimes(2);\n });\n });\n \n describe('report', () => {\n it('should return a readable stream', async () => {\n const config: ReportConfig = {\n directory: './src',\n format: 'sarif'\n };\n \n const stream = await report(config);\n \n expect(stream).toBeInstanceOf(Readable);\n });\n \n it('should use lint results to generate a report', async () => {\n // Create mock module for lint function to spy on\n const lintMock = jest.spyOn(require('../index'), 'lint').mockResolvedValue([mockLintResult]);\n \n const config: ReportConfig = {\n directory: './src',\n format: 'sarif'\n };\n \n await report(config);\n \n expect(lintMock).toHaveBeenCalledWith({\n directory: './src',\n configStylelint: expect.any(String),\n configEslint: expect.any(String)\n });\n \n // Restore the original implementation\n lintMock.mockRestore();\n });\n });\n});\n\ndescribe('Executor placeholder tests', () => {\n it('should be implemented in the future', () => {\n expect(true).toBe(true);\n });\n});"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,kBAA+B;AACxC,SAAS,mBAAmB,6BAA6B;AACzD,SAAS,iBAAiB,0BAA0B;AACpD,SAAoE,0BAA0B;AAE9F,SAAS,2BAA2B;AACpC,SAAS,cAAc;AASvB,eAAsB,KAAK,QAA2C;AACpE,MAAI;AACF,WAAO,MAAM,gCAAgC;AAG7C,UAAM,mBAAmB,oBAAoB,QAAQ,CAAC,GAAG,IAAI;AAG7D,UAAM,aAAa,MAAM,YAAY,UAAU,iBAAiB,WAAW;AAAA,MACzE,UAAU;AAAA,MACV,WAAW;AAAA,IACb,CAAC;AAGD,UAAM,iBAAiB,MAAM,YAAY,UAAU,iBAAiB,WAAW;AAAA,MAC7E,UAAU;AAAA,MACV,WAAW;AAAA,IACb,CAAC;AAGD,UAAM,cAA2B;AAAA,MAC/B,KAAK,iBAAiB;AAAA,MACtB,YAAY,iBAAiB;AAAA,IAC/B;AAGA,UAAM,eAAe,MAAM,WAAW,WAAW,YAAY,SAAS;AAAA,MACpE,GAAG;AAAA,MACH,YAAY,iBAAiB;AAAA,IAC/B,CAAC;AAGD,UAAM,mBAAmB,MAAM,WAAW,WAAW,gBAAgB,aAAa;AAAA,MAChF,GAAG;AAAA,MACH,YAAY,iBAAiB;AAAA,IAC/B,CAAC;AAGD,UAAM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AAM;AACvB,OAAG,mCAAmC,YAAY;AAChD,YAAM,SAAuB;AAAA,QAC3B,WAAW;AAAA,QACX,QAAQ;AAAA,MACV;AAEA,YAAM,SAAS,MAAMD,QAAO,MAAM;AAElC,aAAO,MAAM,EAAE,eAAeG,SAAQ;AAAA,IACxC,CAAC;AAED,OAAG,gDAAgD,YAAY;AAE7D,YAAM,WAAW,KAAK,MAAM,mDAAqB,MAAM,EAAE,kBAAkB,CAAC,cAAc,CAAC;AAE3F,YAAM,SAAuB;AAAA,QAC3B,WAAW;AAAA,QACX,QAAQ;AAAA,MACV;AAEA,YAAMH,QAAO,MAAM;AAEnB,aAAO,QAAQ,EAAE,qBAAqB;AAAA,QACpC,WAAW;AAAA,QACX,iBAAiB,OAAO,IAAI,MAAM;AAAA,QAClC,cAAc,OAAO,IAAI,MAAM;AAAA,MACjC,CAAC;AAGD,eAAS,YAAY;AAAA,IACvB,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AAED,SAAS,8BAA8B,MAAM;AAC3C,KAAG,uCAAuC,MAAM;AAC9C,WAAO,IAAI,EAAE,KAAK,IAAI;AAAA,EACxB,CAAC;AACH,CAAC;",
6
- "names": ["lint", "report", "LintRunner", "FileScanner", "Readable"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/executor/index.ts"],
4
- "sourcesContent": ["import { Readable } from 'stream';\nimport { FileScanner } from '../services/file-scanner';\nimport { LintRunner, LintOptions } from '../services/lint-runner';\nimport { StyleFilePatterns, ComponentFilePatterns } from '../services/file-patterns';\nimport { ReportGenerator, CsvReportGenerator } from '../services/report-generator';\nimport { DEFAULT_ESLINT_CONFIG_PATH, DEFAULT_STYLELINT_CONFIG_PATH, LINTER_CLI_VERSION } from '../services/config.resolver';\nimport { LintResult, LintConfig, ReportConfig } from '../types';\nimport { normalizeCliOptions } from '../utils/config-utils';\nimport { Logger } from '../utils/logger';\n\n/**\n * Run linting on specified files or directory\n * \n * @param config Linting configuration options\n * @returns Promise resolving to an array of lint results\n * @throws Error if linting fails\n */\nexport async function lint(config: LintConfig): Promise<LintResult[]> {\n try {\n Logger.debug('Starting linting with Node API');\n \n // Normalize configuration to ensure all required fields have values\n const normalizedConfig = normalizeCliOptions(config, {}, true);\n \n // Scan directory for style files (CSS, SCSS, etc.)\n const styleFiles = await FileScanner.scanFiles(normalizedConfig.directory, {\n patterns: StyleFilePatterns,\n batchSize: 100,\n });\n \n // Scan directory for component files (HTML, etc.)\n const componentFiles = await FileScanner.scanFiles(normalizedConfig.directory, {\n patterns: ComponentFilePatterns,\n batchSize: 100,\n });\n \n // Configure linting options\n const lintOptions: LintOptions = {\n fix: normalizedConfig.fix,\n configPath: normalizedConfig.configStylelint,\n };\n \n // Run linting on style files\n const styleResults = await LintRunner.runLinting(styleFiles, 'style', {\n ...lintOptions,\n configPath: normalizedConfig.configStylelint,\n });\n \n // Run linting on component files\n const componentResults = await LintRunner.runLinting(componentFiles, 'component', {\n ...lintOptions,\n configPath: normalizedConfig.configEslint,\n });\n \n // Combine results from both linters\n const combinedResults = [...styleResults, ...componentResults];\n \n return combinedResults;\n } catch (error: any) {\n // Enhance error with context for better debugging\n const errorMessage = `Linting failed: ${error.message}`;\n Logger.error(errorMessage);\n throw new Error(errorMessage);\n }\n}\n\n/**\n * Generate a report from linting results\n * \n * @param config Report configuration options\n * @param results Optional lint results (if not provided, will run lint)\n * @returns A readable stream containing the report data\n * @throws Error if report generation fails\n */\nexport async function report(config: ReportConfig, results?: LintResult[]): Promise<Readable> {\n try {\n Logger.debug('Starting report generation with Node API');\n \n // Normalize configuration to ensure all required fields have values\n const normalizedConfig = normalizeCliOptions(config, {}, true);\n \n // Determine report format with default\n const format = normalizedConfig.format || 'sarif';\n \n // Get lint results either from provided results parameter or by running lint\n const lintResults = results || await lint({\n directory: normalizedConfig.directory,\n configStylelint: normalizedConfig.configStylelint,\n configEslint: normalizedConfig.configEslint,\n });\n \n // Process based on requested format\n switch (format) {\n case 'sarif':\n // Generate SARIF report as a stream\n return ReportGenerator.generateSarifReportStream(lintResults, {\n toolName: 'slds-linter',\n toolVersion: LINTER_CLI_VERSION\n });\n \n case 'csv':\n // Generate CSV data in memory and create a stream\n const csvString = CsvReportGenerator.generateCsvString(lintResults);\n const csvStream = new Readable();\n csvStream.push(csvString);\n csvStream.push(null); // End of stream\n return csvStream;\n \n default:\n // Throw error for unsupported formats\n const errorMessage = `Unsupported format: ${format}`;\n Logger.error(errorMessage);\n throw new Error(errorMessage);\n }\n } catch (error: any) {\n // Enhance error with context for better debugging\n const errorMessage = `Report generation failed: ${error.message}`;\n Logger.error(errorMessage);\n throw new Error(errorMessage);\n }\n}\n\nexport type { LintResult, LintResultEntry, LintConfig, ReportConfig, ExitCode, WorkerResult, SarifResultEntry } from '../types'; "],
5
- "mappings": ";AAAA,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,kBAA+B;AACxC,SAAS,mBAAmB,6BAA6B;AACzD,SAAS,iBAAiB,0BAA0B;AACpD,SAAoE,0BAA0B;AAE9F,SAAS,2BAA2B;AACpC,SAAS,cAAc;AASvB,eAAsB,KAAK,QAA2C;AACpE,MAAI;AACF,WAAO,MAAM,gCAAgC;AAG7C,UAAM,mBAAmB,oBAAoB,QAAQ,CAAC,GAAG,IAAI;AAG7D,UAAM,aAAa,MAAM,YAAY,UAAU,iBAAiB,WAAW;AAAA,MACzE,UAAU;AAAA,MACV,WAAW;AAAA,IACb,CAAC;AAGD,UAAM,iBAAiB,MAAM,YAAY,UAAU,iBAAiB,WAAW;AAAA,MAC7E,UAAU;AAAA,MACV,WAAW;AAAA,IACb,CAAC;AAGD,UAAM,cAA2B;AAAA,MAC/B,KAAK,iBAAiB;AAAA,MACtB,YAAY,iBAAiB;AAAA,IAC/B;AAGA,UAAM,eAAe,MAAM,WAAW,WAAW,YAAY,SAAS;AAAA,MACpE,GAAG;AAAA,MACH,YAAY,iBAAiB;AAAA,IAC/B,CAAC;AAGD,UAAM,mBAAmB,MAAM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} from 'commander';\nimport { registerLintCommand } from './commands/lint';\nimport { registerReportCommand } from './commands/report';\nimport { registerEmitCommand } from './commands/emit';\nimport { Logger } from './utils/logger';\nimport { validateNodeVersion } from './utils/nodeVersionUtil';\n\n// Validate Node.js version before proceeding\nvalidateNodeVersion();\n\nprocess.on('unhandledRejection', (error) => {\n Logger.error(`Unhandled rejection: ${error}`);\n process.exit(1);\n});\n\nprocess.on('uncaughtException', (error) => {\n Logger.error(`Uncaught exception: ${error}`);\n process.exit(1);\n});\n\nconst program = new Command();\n\nprogram\n .name('npx @salesforce-ux/slds-linter@latest')\n .showHelpAfterError();\n\nfunction registerVersion(){\n // resolving version and description from env props. check gulp file\n program.description(process.env.CLI_DESCRIPTION)\n .version(process.env.CLI_VERSION);\n}\n\nregisterLintCommand(program);\nregisterReportCommand(program);\nregisterEmitCommand(program);\nregisterVersion();\nprogram.configureHelp({ \n subcommandTerm:(cmd)=>{\n return cmd.name();\n },\n})\n\nprogram.parse(process.argv); "],
5
- "mappings": ";;;AAEA,SAAS,eAAe;AACxB,SAAS,2BAA2B;AACpC,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,2BAA2B;AAGpC,oBAAoB;AAEpB,QAAQ,GAAG,sBAAsB,CAAC,UAAU;AAC1C,SAAO,MAAM,wBAAwB,KAAK,EAAE;AAC5C,UAAQ,KAAK,CAAC;AAChB,CAAC;AAED,QAAQ,GAAG,qBAAqB,CAAC,UAAU;AACzC,SAAO,MAAM,uBAAuB,KAAK,EAAE;AAC3C,UAAQ,KAAK,CAAC;AAChB,CAAC;AAED,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,uCAAuC,EAC5C,mBAAmB;AAEtB,SAAS,kBAAiB;AAExB,UAAQ,YAAY,wDAA2B,EAC9C,QAAQ,eAAuB;AAClC;AAEA,oBAAoB,OAAO;AAC3B,sBAAsB,OAAO;AAC7B,oBAAoB,OAAO;AAC3B,gBAAgB;AAChB,QAAQ,cAAc;AAAA,EACpB,gBAAe,CAAC,QAAM;AACpB,WAAO,IAAI,KAAK;AAAA,EAClB;AACF,CAAC;AAED,QAAQ,MAAM,QAAQ,IAAI;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/services/__tests__/file-scanner.test.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport { FileScanner, ScanOptions } from '../file-scanner';\nimport { StyleFilePatterns } from '../file-patterns';\nimport {mkdir, writeFile, rm} from \"fs/promises\";\nimport { fileURLToPath } from 'url';\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\ndescribe('FileScanner', () => {\n const testDir = path.join(__dirname , 'fixtures');\n\n beforeAll(async () => {\n // Create test directory and files for testing\n await mkdir(testDir, { recursive: true });\n await writeFile(\n path.join(testDir, 'test.css'),\n 'body { color: red; }'\n );\n await writeFile(\n path.join(testDir, 'test.scss'),\n '$color: red;'\n );\n });\n\n afterAll(async () => {\n // Clean up test files\n await rm(testDir, { recursive: true });\n });\n\n it('should scan and batch files correctly', async () => {\n const options: ScanOptions = {\n patterns: StyleFilePatterns,\n batchSize: 1\n };\n\n const batches = await FileScanner.scanFiles(testDir, options);\n \n expect(batches).toHaveLength(2);\n expect(batches[0]).toHaveLength(1);\n expect(batches[1]).toHaveLength(1);\n expect(batches[0][0]).toMatch(/test\\.(css|scss)$/);\n expect(batches[1][0]).toMatch(/test\\.(css|scss)$/);\n });\n\n it('should handle invalid files gracefully', async () => {\n const options: ScanOptions = {\n patterns: {\n extensions: ['nonexistent'],\n exclude: []\n }\n };\n\n const batches = await FileScanner.scanFiles(testDir, options);\n expect(batches).toHaveLength(0);\n });\n}); "],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,mBAAgC;AACzC,SAAS,yBAAyB;AAClC,SAAQ,OAAO,WAAW,UAAS;AACnC,SAAS,qBAAqB;AAC9B,IAAM,aAAa,cAAc,YAAY,GAAG;AAChD,IAAM,YAAY,KAAK,QAAQ,UAAU;AAEzC,SAAS,eAAe,MAAM;AAC5B,QAAM,UAAU,KAAK,KAAK,WAAY,UAAU;AAEhD,YAAU,YAAY;AAEpB,UAAM,MAAM,SAAS,EAAE,WAAW,KAAK,CAAC;AACxC,UAAM;AAAA,MACJ,KAAK,KAAK,SAAS,UAAU;AAAA,MAC7B;AAAA,IACF;AACA,UAAM;AAAA,MACJ,KAAK,KAAK,SAAS,WAAW;AAAA,MAC9B;AAAA,IACF;AAAA,EACF,CAAC;AAED,WAAS,YAAY;AAEnB,UAAM,GAAG,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACvC,CAAC;AAED,KAAG,yCAAyC,YAAY;AACtD,UAAM,UAAuB;AAAA,MAC3B,UAAU;AAAA,MACV,WAAW;AAAA,IACb;AAEA,UAAM,UAAU,MAAM,YAAY,UAAU,SAAS,OAAO;AAE5D,WAAO,OAAO,EAAE,aAAa,CAAC;AAC9B,WAAO,QAAQ,CAAC,CAAC,EAAE,aAAa,CAAC;AACjC,WAAO,QAAQ,CAAC,CAAC,EAAE,aAAa,CAAC;AACjC,WAAO,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,mBAAmB;AACjD,WAAO,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,mBAAmB;AAAA,EACnD,CAAC;AAED,KAAG,0CAA0C,YAAY;AACvD,UAAM,UAAuB;AAAA,MAC3B,UAAU;AAAA,QACR,YAAY,CAAC,aAAa;AAAA,QAC1B,SAAS,CAAC;AAAA,MACZ;AAAA,IACF;AAEA,UAAM,UAAU,MAAM,YAAY,UAAU,SAAS,OAAO;AAC5D,WAAO,OAAO,EAAE,aAAa,CAAC;AAAA,EAChC,CAAC;AACH,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/services/artifact-processor.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport fs from 'fs/promises';\nimport crypto from 'crypto';\nimport { Artifact as SarifArtifact } from 'sarif';\n\nconst BATCH_SIZE = 10;\n\n/**\n * Process artifacts and add file content properties\n * @param artifacts Array of artifacts to process\n */\nexport async function processArtifacts(artifacts: SarifArtifact[]): Promise<void> {\n // Create batches first\n const batches = Array.from(\n { length: Math.ceil(artifacts.length / BATCH_SIZE) },\n (_, i) => artifacts.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE)\n );\n\n // Process batches sequentially\n for (const batch of batches) {\n // Process items within batch concurrently\n await Promise.all(\n batch.map(async (artifact) => {\n try {\n \n // default to html\n artifact.sourceLanguage = 'html';\n \n if (!artifact.location?.uri) {\n console.warn('Warning: Artifact missing location URI');\n return;\n }\n\n const filePath = path.join(process.cwd(), artifact.location.uri);\n const content = await fs.readFile(filePath, 'utf-8');\n \n // Calculate content length\n artifact.length = content.length;\n \n // Calculate content hash using SHA-256\n const hash = crypto.createHash('sha256');\n hash.update(content);\n artifact.hashes = {\n \"sha-256\": hash.digest('hex')\n };\n } catch (error) {\n console.warn(`Warning: Could not process artifact ${artifact.location?.uri}: ${error.message}`);\n }\n })\n );\n }\n} "],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,YAAY;AAGnB,IAAM,aAAa;AAMnB,eAAsB,iBAAiB,WAA2C;AAEhF,QAAM,UAAU,MAAM;AAAA,IACpB,EAAE,QAAQ,KAAK,KAAK,UAAU,SAAS,UAAU,EAAE;AAAA,IACnD,CAAC,GAAG,MAAM,UAAU,MAAM,IAAI,aAAa,IAAI,KAAK,UAAU;AAAA,EAChE;AAGA,aAAW,SAAS,SAAS;AAE3B,UAAM,QAAQ;AAAA,MACZ,MAAM,IAAI,OAAO,aAAa;AAC5B,YAAI;AAGF,mBAAS,iBAAiB;AAE1B,cAAI,CAAC,SAAS,UAAU,KAAK;AAC3B,oBAAQ,KAAK,wCAAwC;AACrD;AAAA,UACF;AAEA,gBAAM,WAAW,KAAK,KAAK,QAAQ,IAAI,GAAG,SAAS,SAAS,GAAG;AAC/D,gBAAM,UAAU,MAAM,GAAG,SAAS,UAAU,OAAO;AAGnD,mBAAS,SAAS,QAAQ;AAG1B,gBAAM,OAAO,OAAO,WAAW,QAAQ;AACvC,eAAK,OAAO,OAAO;AACnB,mBAAS,SAAS;AAAA,YAChB,WAAW,KAAK,OAAO,KAAK;AAAA,UAC9B;AAAA,QACF,SAAS,OAAO;AACd,kBAAQ,KAAK,uCAAuC,SAAS,UAAU,GAAG,KAAK,MAAM,OAAO,EAAE;AAAA,QAChG;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/services/batch-processor.ts"],
4
- "sourcesContent": ["import { Worker } from 'worker_threads';\nimport path from 'path';\nimport os from \"os\";\nimport { Logger } from '../utils/logger';\n\nconst AVAILABLE_CPUS = os.cpus().length - 1;\n\nexport interface BatchProcessorOptions {\n maxWorkers?: number;\n timeoutMs?: number;\n}\n\nexport interface BatchTask<T> {\n files: string[];\n config: T;\n}\n\nexport interface BatchResult {\n success: boolean;\n error?: string;\n results: any[];\n}\n\nexport class BatchProcessor {\n private static DEFAULT_MAX_WORKERS = Math.max(1, Math.min(4, AVAILABLE_CPUS));\n private static DEFAULT_TIMEOUT_MS = 300000; // 5 minutes\n\n /**\n * Process batches of files in parallel using worker threads\n * @param batches Array of file batches to process\n * @param workerScript Path to the worker script\n * @param taskConfig Configuration to pass to each worker\n * @param options Processing options\n */\n static async processBatches<T>(\n batches: string[][],\n workerScript: string,\n taskConfig: T,\n options: BatchProcessorOptions = {}\n ): Promise<BatchResult[]> {\n const maxWorkers = options.maxWorkers || this.DEFAULT_MAX_WORKERS;\n const timeoutMs = options.timeoutMs || this.DEFAULT_TIMEOUT_MS;\n\n Logger.debug(`Starting batch processing with ${maxWorkers} workers`);\n Logger.debug(`Processing ${batches.length} batches`);\n\n const results: BatchResult[] = [];\n const activeWorkers = new Set<Worker>();\n let currentBatchIndex = 0;\n\n try {\n while (currentBatchIndex < batches.length || activeWorkers.size > 0) {\n // Start new workers if we have capacity and batches remaining\n while (\n activeWorkers.size < maxWorkers &&\n currentBatchIndex < batches.length\n ) {\n const batchIndex = currentBatchIndex++;\n const batch = batches[batchIndex];\n const worker = this.createWorker(\n workerScript,\n { files: batch, config: taskConfig },\n timeoutMs\n );\n activeWorkers.add(worker);\n\n // Handle worker completion\n worker\n .on('message', (result: BatchResult) => {\n results.push(result);\n activeWorkers.delete(worker);\n Logger.debug(`Completed batch ${batchIndex} of ${batches.length}`);\n })\n .on('error', (error) => {\n results.push({\n success: false,\n error: error.message,\n results: []\n });\n activeWorkers.delete(worker);\n Logger.error(`Worker error in batch ${batchIndex}: ${error.message}`);\n })\n .on('exit', (code) => {\n if (code !== 0) {\n Logger.warning(`Worker exited with code ${code}`);\n }\n activeWorkers.delete(worker);\n });\n }\n\n // Wait for any worker to complete\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n\n return results;\n } catch (error: any) {\n Logger.error(`Batch processing failed: ${error.message}`);\n throw error;\n } finally {\n // Cleanup any remaining workers\n for (const worker of activeWorkers) {\n worker.terminate();\n }\n }\n }\n\n /**\n * Creates a new worker with timeout handling\n */\n private static createWorker<T>(\n scriptPath: string,\n task: BatchTask<T>,\n timeoutMs: number\n ): Worker {\n const worker = new Worker(scriptPath, {\n workerData: task\n });\n\n // Set up timeout\n const timeoutId = setTimeout(() => {\n Logger.warning(`Worker timeout after ${timeoutMs}ms`);\n worker.terminate();\n }, timeoutMs);\n\n // Clear timeout when worker is done\n worker.once('exit', () => clearTimeout(timeoutId));\n\n return worker;\n }\n} "],
5
- "mappings": ";AAAA,SAAS,cAAc;AAEvB,OAAO,QAAQ;AACf,SAAS,cAAc;AAEvB,IAAM,iBAAiB,GAAG,KAAK,EAAE,SAAS;AAkBnC,IAAM,iBAAN,MAAqB;AAAA,EAC1B,OAAe,sBAAsB,KAAK,IAAI,GAAG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UAC7B,CAAC;AAAA,QACL;AAGA,cAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG,CAAC;AAAA,MACzD;AAEA,aAAO;AAAA,IACT,SAAS,OAAY;AACnB,aAAO,MAAM,4BAA4B,MAAM,OAAO,EAAE;AACxD,YAAM;AAAA,IACR,UAAE;AAEA,iBAAW,UAAU,eAAe;AAClC,eAAO,UAAU;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,OAAe,aACb,YACA,MACA,WACQ;AACR,UAAM,SAAS,IAAI,OAAO,YAAY;AAAA,MACpC,YAAY;AAAA,IACd,CAAC;AAGD,UAAM,YAAY,WAAW,MAAM;AACjC,aAAO,QAAQ,wBAAwB,SAAS,IAAI;AACpD,aAAO,UAAU;AAAA,IACnB,GAAG,SAAS;AAGZ,WAAO,KAAK,QAAQ,MAAM,aAAa,SAAS,CAAC;AAEjD,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/services/config.resolver.ts"],
4
- "sourcesContent": ["// TODO:Move rule meta to metadata package\nimport {ruleMetadata} from '@salesforce-ux/stylelint-plugin-slds';\nimport { resolvePath } from '../utils/nodeVersionUtil';\n\nexport const DEFAULT_ESLINT_CONFIG_PATH = resolvePath('@salesforce-ux/eslint-plugin-slds/.eslintrc.yml', import.meta);\nexport const DEFAULT_STYLELINT_CONFIG_PATH = resolvePath('@salesforce-ux/stylelint-plugin-slds/.stylelintrc.yml', import.meta);\nexport const STYLELINT_VERSION = process.env.STYLELINT_VERSION;\nexport const ESLINT_VERSION = process.env.ESLINT_VERSION;\nexport const LINTER_CLI_VERSION = process.env.CLI_VERSION;\n\nexport const getRuleDescription = (ruleId:string)=>{\n const ruleIdWithoutNameSpace = `${ruleId}`.replace(/\\@salesforce-ux\\//, '');\n return ruleMetadata(ruleIdWithoutNameSpace)?.ruleDesc || '--';\n}"],
5
- "mappings": ";AACA,SAAQ,oBAAmB;AAC3B,SAAS,mBAAmB;AAErB,IAAM,6BAA6B,YAAY,mDAAmD,WAAW;AAC7G,IAAM,gCAAgC,YAAY,yDAAyD,WAAW;AACtH,IAAM,oBAAoB;AAC1B,IAAM,iBAAiB;AACvB,IAAM,qBAAqB;AAE3B,IAAM,qBAAqB,CAAC,WAAgB;AAC/C,QAAM,yBAAyB,GAAG,MAAM,GAAG,QAAQ,qBAAqB,EAAE;AAC1E,SAAO,aAAa,sBAAsB,GAAG,YAAY;AAC7D;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/services/file-patterns.ts"],
4
- "sourcesContent": ["import { FilePattern } from './file-scanner';\n\nexport const StyleFilePatterns: FilePattern = {\n extensions:['css', 'scss', 'less','sass'],\n exclude: [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**'\n ]\n};\n\nexport const ComponentFilePatterns: FilePattern = {\n extensions:['html', 'cmp', 'component', 'app', 'page', 'interface'], \n exclude: [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**'\n ]\n}; "],
5
- "mappings": ";AAEO,IAAM,oBAAiC;AAAA,EAC5C,YAAW,CAAC,OAAO,QAAQ,QAAO,MAAM;AAAA,EACxC,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,IAAM,wBAAqC;AAAA,EAChD,YAAW,CAAC,QAAQ,OAAO,aAAa,OAAO,QAAQ,WAAW;AAAA,EAClE,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/services/file-scanner.ts"],
4
- "sourcesContent": ["import { promises as fs } from \"fs\";\nimport { Logger } from \"../utils/logger\";\nimport {globby} from 'globby';\nimport {extname} from \"path\";\n\nexport interface FilePattern {\n extensions:string[];\n exclude?: string[];\n}\n\nexport interface ScanOptions {\n patterns: FilePattern;\n batchSize?: number;\n}\n\nexport class FileScanner {\n private static DEFAULT_BATCH_SIZE = 100;\n\n /**\n * Scans directory for files matching the given patterns\n * @param directory Base directory to scan\n * @param options Scanning options including patterns and batch size\n * @returns Array of file paths in batches\n */\n static async scanFiles(\n directory: string,\n options: ScanOptions\n ): Promise<string[][]> {\n try {\n Logger.debug(`Scanning directory: ${directory}`);\n\n const allFiles: string[] = await globby(directory, {\n cwd: process.cwd(),\n expandDirectories:true,\n unique:true,\n ignore: options.patterns.exclude,\n onlyFiles: true,\n dot: true, // Include.dot files\n absolute: true,\n gitignore:true\n }).then(matches => matches.filter(match => {\n const fileExt = extname(match).substring(1);\n return options.patterns.extensions.includes(fileExt);\n }));\n\n // Validate files exist and are readable\n const validFiles = await this.validateFiles(allFiles);\n\n // Split into batches\n const batchSize = options.batchSize || this.DEFAULT_BATCH_SIZE;\n const batches = this.createBatches(validFiles, batchSize);\n\n Logger.debug(\n `Found ${validFiles.length} files, split into ${batches.length} batches`\n );\n return batches;\n } catch (error: any) {\n Logger.error(`Failed to scan files: ${error.message}`);\n throw error;\n }\n }\n\n /**\n * Validates that files exist and are readable\n */\n private static async validateFiles(files: string[]): Promise<string[]> {\n const validFiles: string[] = [];\n\n for (const file of files) {\n try {\n await fs.access(file, fs.constants.R_OK);\n validFiles.push(file);\n } catch (error) {\n Logger.warning(`Skipping inaccessible file: ${file}`);\n }\n }\n\n return validFiles;\n }\n\n /**\n * Splits array of files into batches\n */\n private static createBatches(files: string[], batchSize: number): string[][] {\n const batches: string[][] = [];\n for (let i = 0; i < files.length; i += batchSize) {\n batches.push(files.slice(i, i + batchSize));\n }\n return batches;\n }\n}\n"],
5
- "mappings": ";AAAA,SAAS,YAAY,UAAU;AAC/B,SAAS,cAAc;AACvB,SAAQ,cAAa;AACrB,SAAQ,eAAc;AAYf,IAAM,cAAN,MAAkB;AAAA,EACvB,OAAe,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;AAAA,IAC5C;AACA,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/services/lint-runner.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport { BatchProcessor, BatchResult } from './batch-processor';\nimport { WorkerConfig, WorkerResult, LintResult } from '../types';\nimport { Logger } from '../utils/logger';\nimport { resolveDirName } from '../utils/nodeVersionUtil';\n\nexport interface LintOptions {\n fix?: boolean;\n configPath?: string;\n maxWorkers?: number;\n timeoutMs?: number;\n}\n\nexport class LintRunner {\n /**\n * Run linting on batches of files\n */\n static async runLinting(\n fileBatches: string[][],\n workerType: 'style' | 'component',\n options: LintOptions = {}\n ): Promise<LintResult[]> {\n try {\n const workerScript = path.resolve(\n resolveDirName(import.meta) ,\n '../workers',\n workerType === 'style' ? 'stylelint.worker.js' : 'eslint.worker.js'\n );\n\n const workerConfig: WorkerConfig = {\n configPath: options.configPath,\n fix: options.fix\n };\n\n const results = await BatchProcessor.processBatches(\n fileBatches,\n workerScript,\n workerConfig,\n {\n maxWorkers: options.maxWorkers,\n timeoutMs: options.timeoutMs\n }\n );\n\n return this.processResults(results);\n } catch (error: any) {\n Logger.error(`Linting failed: ${error.message}`);\n throw error;\n }\n }\n\n /**\n * Process and normalize worker results\n */\n private static processResults(batchResults: BatchResult[]): LintResult[] {\n const results: LintResult[] = [];\n\n for (const batch of batchResults) {\n if (!batch.success || !batch.results) {\n Logger.warning(`Batch failed: ${batch.error}`);\n continue;\n }\n\n for (const result of batch.results as WorkerResult[]) {\n if (result.error) {\n Logger.warning(`File processing failed: ${result.file} - ${result.error}`);\n continue;\n }\n\n results.push({\n filePath: result.file,\n errors: result.errors?.map(e => ({\n ...e,\n severity: 2\n })) || [],\n warnings: result.warnings?.map(w => ({\n ...w,\n severity: 1\n })) || []\n });\n }\n }\n\n return results;\n }\n} "],
5
- "mappings": ";AAAA,OAAO,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E,KAAK,CAAC;AAAA,QACV,CAAC;AAAA,MACH;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/services/report-generator.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport fs, { writeFile } from 'fs/promises';\nimport { mkConfig, generateCsv, asString } from 'export-to-csv';\nimport { LintResult, LintResultEntry, SarifResultEntry } from '../types';\nimport { SarifBuilder, SarifRunBuilder, SarifResultBuilder, SarifRuleBuilder } from 'node-sarif-builder';\nimport { createWriteStream } from 'fs';\nimport { JsonStreamStringify } from 'json-stream-stringify';\nimport {getRuleDescription} from \"./config.resolver\";\nimport { parseText, replaceNamespaceinRules, transformedResults } from '../utils/lintResultsUtil';\nimport { Readable } from 'stream';\nimport { processArtifacts } from './artifact-processor';\n\n\nexport interface ReportOptions {\n outputPath?: string;\n toolName: string;\n toolVersion: string;\n}\n\nexport class ReportGenerator {\n /**\n * Generate SARIF report from lint results with file output\n */\n static async generateSarifReport(\n results: LintResult[],\n options: ReportOptions\n ): Promise<void> {\n // If no outputPath, we're just building the report in memory\n if (!options.outputPath) {\n return;\n }\n \n // Build SARIF report data\n const sarifReport = await this.buildSarifReport(results, options);\n \n // Process artifacts and add file content properties\n for (const run of sarifReport.runs) {\n await processArtifacts(run.artifacts);\n }\n \n // Ensure output directory exists\n const outputDir = path.dirname(options.outputPath);\n await fs.mkdir(outputDir, { recursive: true });\n\n // Use JsonStreamStringify to write large JSON efficiently\n const writeStream = createWriteStream(options.outputPath);\n const jsonStream = new JsonStreamStringify(sarifReport, null, 2); // pretty print with 2 spaces\n \n // Write the report\n await new Promise<void>((resolve, reject) => {\n jsonStream\n .pipe(writeStream)\n .on('finish', resolve)\n .on('error', reject);\n }); \n }\n \n /**\n * Generate SARIF report as a stream without creating a file\n */\n static async generateSarifReportStream(\n results: LintResult[],\n options: ReportOptions\n ): Promise<Readable> {\n // Create SARIF report\n const sarifReport = await this.buildSarifReport(results, options);\n \n // Return JsonStreamStringify as a readable stream\n return new JsonStreamStringify(sarifReport, null, 2);\n }\n\n /**\n * Build SARIF report data in memory\n */\n static async buildSarifReport(\n results: LintResult[],\n options: ReportOptions\n ): Promise<any> {\n const builder = new SarifBuilder();\n const runBuilder = new SarifRunBuilder({\n defaultSourceLanguage: 'html'\n }).initSimple({\n toolDriverName: options.toolName,\n toolDriverVersion: options.toolVersion,\n url: 'https://github.com/salesforce-ux/slds-linter'\n });\n\n // Add additional properties for better SARIF compatibility\n runBuilder.run.properties = {\n id: Number(Math.random().toString(10).substring(2, 10)),\n version: options.toolVersion,\n submissionDate: new Date().toISOString().split('T')[0],\n language: 'html',\n status: 'accepted',\n type: 'source code'\n };\n\n runBuilder.run.tool.driver.organization = \"Salesforce\";\n\n // Add rules\n const rules = this.extractRules(results);\n for (const rule of rules) {\n const ruleBuilder = new SarifRuleBuilder().initSimple({\n ruleId: replaceNamespaceinRules(rule.id),\n shortDescriptionText: rule.shortDescription?.text,\n });\n runBuilder.addRule(ruleBuilder);\n }\n\n // Add results\n for (const result of results) {\n this.addResultsToSarif(runBuilder, result);\n }\n\n // Add run to builder\n builder.addRun(runBuilder);\n\n // Return the report data\n return builder.buildSarifOutput();\n }\n\n /**\n * Extract unique rules from results\n */\n private static extractRules(results: LintResult[]): any[] {\n const rules = new Map();\n\n for (const result of results) {\n // Process errors\n for (const error of result.errors) {\n if (!rules.has(error.ruleId)) {\n \n rules.set(error.ruleId, {\n id: replaceNamespaceinRules(error.ruleId),\n shortDescription: {\n text: getRuleDescription(replaceNamespaceinRules(error.ruleId))\n },\n properties: {\n category: 'Style'\n }\n });\n }\n }\n\n // Process warnings\n for (const warning of result.warnings) {\n if (!rules.has(warning.ruleId)) { \n rules.set(warning.ruleId, {\n id: replaceNamespaceinRules(warning.ruleId),\n shortDescription: {\n text: getRuleDescription(replaceNamespaceinRules(warning.ruleId))\n },\n properties: {\n category: 'Style'\n }\n });\n }\n }\n }\n\n return Array.from(rules.values());\n }\n\n /**\n * Add lint results to SARIF report\n */\n private static addResultsToSarif(\n runBuilder: SarifRunBuilder,\n lintResult: LintResult\n ): void {\n lintResult.errors.forEach(error => {\n const resultBuilder = new SarifResultBuilder().initSimple(transformedResults(lintResult, error, 'error'));\n runBuilder.addResult(resultBuilder);\n });\n\n lintResult.warnings.forEach(warning => {\n const resultBuilder = new SarifResultBuilder().initSimple(transformedResults(lintResult, warning, 'warning'));\n runBuilder.addResult(resultBuilder);\n });\n }\n}\n\nexport class CsvReportGenerator {\n /**\n * Generate CSV report and write to file\n */\n static async generate(results: any[]): Promise<string> {\n // Generate CSV string using the shared method\n const csvString = this.generateCsvString(results);\n \n // Define the output path\n const csvReportPath = path.join(process.cwd(), 'slds-linter-report.csv');\n\n // Write to file\n await writeFile(csvReportPath, csvString);\n return csvReportPath;\n }\n \n /**\n * Generate CSV string from lint results\n */\n static generateCsvString(results: any[]): string {\n const csvData = this.convertResultsToCsvData(results);\n return asString(csvData);\n }\n \n /**\n * Convert lint results to CSV-compatible data format\n */\n private static convertResultsToCsvData(results: any[]): any {\n const cwd = process.cwd();\n \n // Create CSV config inline instead of using a separate method\n const csvConfig = mkConfig({\n fieldSeparator: ',',\n quoteStrings: true,\n decimalSeparator: '.',\n useTextFile: false,\n useBom: true,\n useKeysAsHeaders: true,\n });\n\n const transformedResults = results.flatMap((result: { errors: any[]; filePath: string; warnings: any[]; }) =>\n [\n ...result.errors.map((error: { message: any; ruleId: any; line: any; column: any; endLine: any; endColumn: any; }) => ({\n \"File Path\": path.relative(cwd, result.filePath),\n \"Message\": parseText(error.message),\n \"Severity\": 'error',\n \"Rule ID\": replaceNamespaceinRules(error.ruleId || 'N/A'),\n \"Start Line\": error.line,\n \"Start Column\": error.column,\n \"End Line\": error.endLine || error.line, // Default to start line if missing\n \"End Column\": error.endColumn || error.column // Default to start column if missing\n })),\n ...result.warnings.map((warning: { message: any; ruleId: any; line: any; column: any; endLine: any; endColumn: any; }) => ({\n \"File Path\": path.relative(cwd, result.filePath),\n \"Message\": parseText(warning.message),\n \"Severity\": 'warning',\n \"Rule ID\": replaceNamespaceinRules(warning.ruleId || 'N/A'),\n \"Start Line\": warning.line,\n \"Start Column\": warning.column,\n \"End Line\": warning.endLine || warning.line, // Default to start line if missing\n \"End Column\": warning.endColumn || warning.column // Default to start column if missing\n }))\n ]\n );\n\n return generateCsv(csvConfig)(transformedResults);\n }\n}"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,OAAO,MAAM,iBAAiB;AAC9B,SAAS,UAAU,aAAa,gBAAgB;AAEhD,SAAS,cAAc,iBAAiB,oBAAoB,wBAAwB;AACpF,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAQ,0BAAyB;AACjC,SAAS,WAAW,yBAAyB,0BAA0B;AAEvE,SAAS,wBAAwB;AAS1B,IAAM,kBAAN,MAAsB;AAAA;AAAA;AAAA;AAAA,EAI3B,aAAa,oBACX,SACA,SACe;AAEb,QAAI,CAAC,QAAQ,YAAY;AACvB;AAAA,IACF;AAGA,UAAM,cAAc,MAAM,KAAK,iBAAiB,SAAS,OAAO;AAGhE,eAAW,OAAO,YAAY,MAAM;AAClC,YAAM,iBAAiB,IAAI,SAAS;AAAA,IACtC;AAGA,UAAM,YAAY,KAAK,QAAQ,QAAQ,UAAU;AACjD,UAAM,GAAG,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;AAG7C,UAAM,cAAc,kBAAkB,QAAQ,UAAU;AACxD,UAAM,aAAa,IAAI,oBAAoB,aAAa,MAAM,CAAC;AAG/D,UAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AAC3C,iBACG,KAAK,WAAW,EAChB,GAAG,UAAU,OAAO,EACpB,GAAG,SAAS,MAAM;AAAA,IACvB,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,aAAa,0BACX,SACA,SACmB;AAEnB,UAAM,cAAc,MAAM,KAAK,iBAAiB,SAAS,OAAO;AAGhE,WAAO,I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"sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/config-utils.ts"],
4
- "sourcesContent": ["/**\n * Config utilities for SLDS Linter\n * \n * Note: This file replaces the earlier cli-args.ts and consolidates configuration \n * handling for both CLI and Node API into a single place\n */\nimport path from 'path';\nimport { LintConfig, ReportConfig, CliOptions } from '../types';\nimport { DEFAULT_ESLINT_CONFIG_PATH, DEFAULT_STYLELINT_CONFIG_PATH } from '../services/config.resolver';\nimport { isDynamicPattern } from 'globby';\nimport { accessSync } from 'fs';\nimport { Logger } from './logger';\n\n/**\n * Normalize and validate a file path\n * This function ensures that the provided path exists and is accessible\n * If no path is provided, it defaults to the current working directory\n * \n * @param inputPath Input file path or undefined\n * @returns Normalized and validated absolute path\n * @throws Error if the path is invalid or inaccessible\n */\nexport function normalizeAndValidatePath(inputPath?: string): string {\n // Default to current working directory if no path provided\n if (!inputPath) {\n Logger.debug('No path provided, using current working directory');\n return process.cwd();\n }\n\n // Resolve to absolute path\n const normalizedPath = path.resolve(inputPath);\n Logger.debug(`Normalized path: ${normalizedPath}`);\n\n try {\n // Check if path exists and is accessible\n accessSync(normalizedPath);\n return normalizedPath;\n } catch (error) {\n // Throw descriptive error if path is invalid\n const errorMessage = `Invalid path: ${inputPath}`;\n Logger.error(errorMessage);\n throw new Error(errorMessage);\n }\n}\n\n/**\n * Normalize directory path with special handling for glob patterns\n * This function preserves glob patterns and resolves regular paths to absolute paths\n * If no directory is provided, it defaults to the current working directory\n * \n * @param directory Input directory or glob pattern or undefined\n * @returns Normalized directory path\n */\nexport function normalizeDirectoryPath(directory?: string): string {\n // Default to current working directory if no directory provided\n if (!directory) {\n Logger.debug('No directory provided, using current working directory');\n return process.cwd();\n }\n \n // If it's a glob pattern, return as-is to preserve pattern matching\n if (isDynamicPattern(directory)) {\n Logger.debug(`Detected glob pattern: ${directory}`);\n return directory;\n }\n \n // For regular directories, resolve to absolute path\n Logger.debug(`Normalizing directory path: ${directory}`);\n return path.resolve(directory);\n}\n\n/**\n * Normalize configuration with appropriate defaults\n * This function ensures all required options have valid values\n * It applies provided defaults, then user-provided options, then normalizes paths\n * Used by both CLI commands and Node API functions\n * \n * @param options Options to normalize\n * @param defaultOptions Default options to apply\n * @param isNodeApi Whether this is being called from the Node API\n * @returns Normalized options with appropriate defaults\n */\nexport function normalizeCliOptions<T extends CliOptions | LintConfig | ReportConfig>(\n options: T,\n defaultOptions: Partial<T> = {},\n isNodeApi = false\n): T {\n // Set up defaults based on context\n const baseDefaults: Partial<CliOptions> = {\n files: [],\n configStylelint: isNodeApi ? DEFAULT_STYLELINT_CONFIG_PATH : \"\",\n configEslint: isNodeApi ? DEFAULT_ESLINT_CONFIG_PATH : \"\",\n };\n \n // Add CLI-specific defaults\n if (!isNodeApi) {\n Object.assign(baseDefaults, {\n fix: false,\n editor: \"vscode\",\n format: \"sarif\",\n });\n }\n \n // Create normalized options with proper precedence\n const normalizedOptions = {\n ...baseDefaults,\n ...defaultOptions,\n ...options,\n directory: normalizeDirectoryPath(options.directory),\n };\n \n // Handle output path for CLI options\n if (!isNodeApi) {\n (normalizedOptions as any).output = (options as any).output \n ? normalizeAndValidatePath((options as any).output)\n : process.cwd();\n }\n \n // Handle ReportConfig specific fields\n if ('format' in options && !options.format && isNodeApi) {\n (normalizedOptions as any).format = 'sarif';\n }\n \n return normalizedOptions as T;\n}\n\n// For backward compatibility with imports, but deprecate in future versions\nexport const normalizeConfig = normalizeCliOptions; "],
5
- "mappings": ";AAMA,OAAO,UAAU;AAEjB,SAAS,4BAA4B,qCAAqC;AAC1E,SAAS,wBAAwB;AACjC,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AAWhB,SAAS,yBAAyB,WAA4B;AAEnE,MAAI,CAAC,WAAW;AACd,WAAO,MAAM,mDAAmD;AAChE,WAAO,QAAQ,IAAI;AAAA,EACrB;AAGA,QAAM,iBAAiB,KAAK,QAAQ,SAA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"sources": ["../../src/utils/editorLinkUtil.ts"],
4
- "sourcesContent": ["// src/utils/editorLinkUtil.ts\n\nimport chalk from 'chalk';\n\n/**\n * Returns an editor-specific link for opening a file at a given line and column.\n *\n * @param editor - The editor to use (e.g., 'vscode', 'atom', 'sublime').\n * @param absolutePath - The absolute path to the file.\n * @param line - The line number in the file.\n * @param column - The column number in the file.\n * @returns A URL string that can be used to open the file in the specified editor.\n */\nexport function getEditorLink(\n editor: string,\n absolutePath: string,\n line: number,\n column: number\n): string {\n if (editor === 'vscode') {\n return `vscode://file/${absolutePath}:${line}:${column}`;\n } else if (editor === 'atom') {\n return `atom://core/open/file?filename=${absolutePath}&line=${line}&column=${column}`;\n } else if (editor === 'sublime') {\n // Sublime Text does not have a standard URL scheme.\n return `file://${absolutePath}:${line}:${column}`;\n } else {\n // Fallback to a standard file URL.\n return `file://${absolutePath}:${line}:${column}`;\n }\n}\n\n/**\n * Creates an ANSI hyperlink (if supported) for the line:column text.\n *\n * @param lineCol - The line:column string (e.g., \"10:5\").\n * @param absolutePath - The absolute path to the file.\n * @param line - The line number in the file.\n * @param column - The column number in the file.\n * @param editor - The editor to use (e.g., 'vscode', 'atom', 'sublime').\n * @returns A string with ANSI escape sequences to create a clickable hyperlink.\n */\nexport function createClickableLineCol(\n lineCol: string,\n absolutePath: string,\n line: number,\n column: number,\n editor: string\n): string {\n const link = getEditorLink(editor, absolutePath, line, column);\n return `\\u001b]8;;${link}\\u0007${chalk.blueBright(lineCol)}\\u001b]8;;\\u0007`;\n}\n"],
5
- "mappings": ";AAEA,OAAO,WAAW;AAWX,SAAS,cACd,QACA,cACA,MACA,QACQ;AACR,MAAI,WAAW,UAAU;AACvB,WAAO,iBAAiB,YAAY,IAAI,IAAI,IAAI,MAAM;AAAA,EACxD,WAAW,WAAW,QAAQ;AAC5B,WAAO,kCAAkC,YAAY,SAAS,IAAI,WAAW,MAAM;AAAA,EACrF,WAAW,WAAW,WAAW;AAE/B,WAAO,UAAU,YAAY,IAAI,IAAI,IAAI,MAAM;AAAA,EACjD,OAAO;AAEL,WAAO,UAAU,YAAY,IAAI,IAAI,IAAI,MAAM;AAAA,EACjD;AACF;AAYO,SAAS,uBACd,SACA,cACA,MACA,QACA,QACQ;AACR,QAAM,OAAO,cAAc,QAAQ,cAAc,MAAM,MAAM;AAC7D,SAAO,WAAa,IAAI,OAAS,MAAM,WAAW,OAAO,CAAC;AAC5D;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/lintResultsUtil.ts"],
4
- "sourcesContent": ["// src/utils/lintResultsUtil.ts\n\nimport chalk from 'chalk';\nimport path from 'path';\nimport { createClickableLineCol } from './editorLinkUtil';\nimport { Logger } from '../utils/logger';\nimport { LintResult, LintResultEntry, SarifResultEntry } from '../types';\n\n/**\n * \n * @param id - Rule id\n * @returns updated Rule id without the namespace @salesforce-ux\n */\nexport function replaceNamespaceinRules(id: string) {\n return id.includes(\"@salesforce-ux/\")\n ? id.replace(\"@salesforce-ux/\", \"\")\n : id;\n}\n/**\n * \n * @param text - The input text that could either be a plain string or a stringified JSON object.\n * @returns The parsed message or the original string if parsing fails.\n */\nexport function parseText(text: string): string {\n let safeText = text;\n try {\n // Try to parse the text as JSON\n const parsed = JSON.parse(text);\n // If successful, return the message property or the whole object if no message\n safeText = parsed.message || JSON.stringify(parsed);\n } catch (error) {\n // If JSON parsing fails, return the original string\n safeText = text;\n }\n return safeText.endsWith('.') ? safeText : `${safeText}.`;\n}\n\n/**\n * Prints detailed lint results for each file that has issues.\n *\n * @param results - Array of lint results.\n * @param editor - The chosen editor for clickable links (e.g., \"vscode\", \"atom\", \"sublime\").\n */\nexport function printLintResults(results: LintResult[], editor: string): void {\n results.forEach(result => {\n const hasErrors = result.errors && result.errors.length > 0;\n const hasWarnings = result.warnings && result.warnings.length > 0;\n if (!hasErrors && !hasWarnings) return;\n\n const absolutePath = result.filePath || '';\n const relativeFile = path.relative(process.cwd(), absolutePath) || 'Unknown file';\n // Print file name with a preceding new line for spacing.\n Logger.newLine().info(`${chalk.bold(relativeFile)}`);\n\n if (hasErrors) {\n result.errors.forEach((error: any) => {\n if (error.line && error.column && absolutePath) {\n const lineCol = `${error.line}:${error.column}`;\n const clickable = createClickableLineCol(lineCol, absolutePath, error.line, error.column, editor);\n const ruleId = error.ruleId ? chalk.dim(replaceNamespaceinRules(error.ruleId)) : '';\n Logger.error(` ${clickable} ${parseText(error.message)} ${ruleId}`);\n } else {\n Logger.error(` ${chalk.red('Error:')} ${parseText(error.message)}`);\n }\n });\n }\n\n if (hasWarnings) {\n result.warnings.forEach((warn: any) => {\n if (warn.line && warn.column && absolutePath) {\n const lineCol = `${warn.line}:${warn.column}`;\n const clickable = createClickableLineCol(lineCol, absolutePath, warn.line, warn.column, editor);\n const ruleId = warn.ruleId ? chalk.dim(replaceNamespaceinRules(warn.ruleId)) : '';\n Logger.warning(` ${clickable} ${parseText(warn.message)} ${ruleId}`);\n } else {\n Logger.warning(` ${chalk.yellow('Warning:')} ${parseText(warn.message)}`);\n }\n });\n }\n });\n}\n\nexport function transformedResults(lintResult: LintResult, entry: LintResultEntry, level: 'error' | 'warning'): SarifResultEntry {\n return {\n ruleId: replaceNamespaceinRules(entry.ruleId),\n level,\n messageText: parseText(entry.message),\n fileUri: path.relative(process.cwd(), lintResult.filePath),\n startLine: entry.line,\n startColumn: entry.column,\n endLine: entry.line,\n endColumn: entry.endColumn\n }\n}"],
5
- "mappings": ";AAEA,OAAO,WAAW;AAClB,OAAO,UAAU;AACjB,SAAS,8BAA8B;AACvC,SAAS,cAAc;AAQhB,SAAS,wBAAwB,IAAY;AAClD,SAAO,GAAG,SAAS,iBAAiB,IAChC,GAAG,QAAQ,mBAAmB,EAAE,IAChC;AACN;AAMO,SAAS,UAAU,MAAsB;AAC9C,MAAI,WAAW;AACf,MAAI;AAEF,UAAM,SAAS,KAAK,MAAM,IAAI;AAE9B,eAAW,OAAO,WAAW,KAAK,UAAU,MAAM;AAAA,EAC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K,SAAS,MAAM,IAAI,wBAAwB,KAAK,MAAM,CAAC,IAAI;AAC/E,iBAAO,QAAQ,KAAK,SAAS,KAAK,UAAU,KAAK,OAAO,CAAC,KAAK,MAAM,EAAE;AAAA,QACxE,OAAO;AACL,iBAAO,QAAQ,KAAK,MAAM,OAAO,UAAU,CAAC,IAAI,UAAU,KAAK,OAAO,CAAC,EAAE;AAAA,QAC3E;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;AAEO,SAAS,mBAAmB,YAAwB,OAAwB,OAA8C;AAC/H,SAAO;AAAA,IACL,QAAQ,wBAAwB,MAAM,MAAM;AAAA,IAC5C;AAAA,IACA,aAAa,UAAU,MAAM,OAAO;AAAA,IACpC,SAAS,KAAK,SAAS,QAAQ,IAAI,GAAG,WAAW,QAAQ;AAAA,IACzD,WAAW,MAAM;AAAA,IACjB,aAAa,MAAM;AAAA,IACnB,SAAS,MAAM;AAAA,IACf,WAAW,MAAM;AAAA,EACnB;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/logger.ts"],
4
- "sourcesContent": ["import chalk from 'chalk';\n\nexport class Logger {\n static newLine(){\n console.log('\\n');\n return this;\n }\n static info(message: string): void {\n console.log(chalk.blue('\u2139'), message);\n }\n\n static success(message: string): void {\n console.log(chalk.green('\u2713'), message);\n }\n\n static warning(message: string): void {\n console.warn(chalk.yellow('\u26A0'), message);\n }\n\n static error(message: string): void {\n console.error(chalk.red('\u2716'), message);\n }\n\n static debug(message: string): void {\n if (process.env.DEBUG) {\n console.debug(chalk.gray('\uD83D\uDD0D'), message);\n }\n }\n} "],
5
- "mappings": ";AAAA,OAAO,WAAW;AAEX,IAAM,SAAN,MAAa;AAAA,EAClB,OAAO,UAAS;AACd,YAAQ,IAAI,IAAI;AAChB,WAAO;AAAA,EACT;AAAA,EACA,OAAO,KAAK,SAAuB;AACjC,YAAQ,IAAI,MAAM,KAAK,QAAG,GAAG,OAAO;AAAA,EACtC;AAAA,EAEA,OAAO,QAAQ,SAAuB;AACpC,YAAQ,IAAI,MAAM,MAAM,QAAG,GAAG,OAAO;AAAA,EACvC;AAAA,EAEA,OAAO,QAAQ,SAAuB;AACpC,YAAQ,KAAK,MAAM,OAAO,QAAG,GAAG,OAAO;AAAA,EACzC;AAAA,EAEA,OAAO,MAAM,SAAuB;AAClC,YAAQ,MAAM,MAAM,IAAI,QAAG,GAAG,OAAO;AAAA,EACvC;AAAA,EAEA,OAAO,MAAM,SAAuB;AAClC,QAAI,QAAQ,IAAI,OAAO;AACrB,cAAQ,MAAM,MAAM,KAAK,WAAI,GAAG,OAAO;AAAA,IACzC;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/nodeVersionUtil.ts"],
4
- "sourcesContent": ["import semver from 'semver';\nimport { fileURLToPath } from 'url';\nimport { dirname } from 'path';\nimport {resolve} from 'import-meta-resolve'; // This package is a ponyfill for import.meta.resolve Node 16-20\nimport { Logger } from './logger'; // Ensure this path is correct\n\nexport const REQUIRED_NODE_VERSION = \">=18.4.0\";\n\n/**\n * Checks if the current Node.js version meets the required version.\n * @param {string} requiredVersion - The required Node.js version.\n * @returns {boolean} - Returns true if the current version is valid.\n */\nexport function checkNodeVersion(requiredVersion) {\n return semver.satisfies(process.version, requiredVersion);\n}\n\n/**\n * Validates the Node.js version and exits if it does not meet the requirement.\n */\nexport function validateNodeVersion() {\n if (!checkNodeVersion(REQUIRED_NODE_VERSION)) {\n if(checkNodeVersion(\"<18.4.x\")){\n Logger.warning(\n `SLDS Linter CLI works best with Node.js version v18.4.0 or later. \n We recommend using the latest [Active LTS](https://nodejs.org/en/about/previous-releases) version of Node.js.`\n );\n }\n }\n}\n\n/**\n * Util to resolve dirName from import meta compatible with node v18\n * Letst version of node have import.meta.dirname\n * @param importMeta \n * @returns \n */\nexport function resolveDirName(importMeta:ImportMeta){\n if(\"dirname\" in importMeta){\n return importMeta.dirname;\n }\n return dirname(fileURLToPath((importMeta as ImportMeta).url));\n}\n\nexport function resolvePath(specifier:string, importMeta:ImportMeta) {\n let fileUrl = ''\n if(\"resolve\" in importMeta){\n fileUrl = importMeta.resolve(specifier); \n } else {\n fileUrl = resolve(specifier, (importMeta as ImportMeta).url)//new URL(specifier, (importMeta as ImportMeta).url).href;\n }\n return fileURLToPath(fileUrl);\n};"],
5
- "mappings": ";AAAA,OAAO,YAAY;AACnB,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAQ,eAAc;AACtB,SAAS,cAAc;AAEhB,IAAM,wBAAwB;AAO9B,SAAS,iBAAiB,iBAAiB;AAChD,SAAO,OAAO,UAAU,QAAQ,SAAS,eAAe;AAC1D;AAKO,SAAS,sBAAsB;AACpC,MAAI,CAAC,iBAAiB,qBAAqB,GAAG;AAC5C,QAAG,iBAAiB,SAAS,GAAE;AAC7B,aAAO;AAAA,QACL;AAAA;AAAA,MAEF;AAAA,IACF;AAAA,EACF;AACF;AAQO,SAAS,eAAe,YAAsB;AACnD,MAAG,aAAa,YAAW;AACzB,WAAO,WAAW;AAAA,EACpB;AACA,SAAO,QAAQ,cAAe,WAA0B,GAAG,CAAC;AAC9D;AAEO,SAAS,YAAY,WAAkB,YAAuB;AACnE,MAAI,UAAU;AACd,MAAG,aAAa,YAAW;AACzB,cAAU,WAAW,QAAQ,SAAS;AAAA,EACxC,OAAO;AACL,cAAU,QAAQ,WAAY,WAA0B,GAAG;AAAA,EAC7D;AACA,SAAO,cAAc,OAAO;AAC9B;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/workers/base.worker.ts"],
4
- "sourcesContent": ["import { parentPort, workerData } from 'worker_threads';\nimport { BatchTask, BatchResult } from '../services/batch-processor';\n\nexport abstract class BaseWorker<T, R> {\n protected task: BatchTask<T>;\n\n constructor() {\n this.task = workerData as BatchTask<T>;\n }\n\n /**\n * Process a single file\n * @param filePath Path to the file to process\n * @returns Processing result\n */\n protected abstract processFile(filePath: string): Promise<R>;\n\n /**\n * Start processing the batch of files\n */\n async process(): Promise<void> {\n try {\n const results: R[] = [];\n\n for (const file of this.task.files) {\n try {\n const result = await this.processFile(file);\n results.push(result);\n } catch (error: any) {\n results.push({\n file,\n error: error.message\n } as R);\n }\n }\n\n const batchResult: BatchResult = {\n success: true,\n results\n };\n\n parentPort?.postMessage(batchResult);\n } catch (error: any) {\n const errorResult: BatchResult = {\n success: false,\n error: error.message,\n results: []\n };\n \n parentPort?.postMessage(errorResult);\n } finally {\n process.exit(0);\n }\n }\n} "],
5
- "mappings": ";AAAA,SAAS,YAAY,kBAAkB;AAGhC,IAAe,aAAf,MAAgC;AAAA,EAC3B;AAAA,EAEV,cAAc;AACZ,SAAK,OAAO;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,UAAyB;AAC7B,QAAI;AACF,YAAM,UAAe,CAAC;AAEtB,iBAAW,QAAQ,KAAK,KAAK,OAAO;AAClC,YAAI;AACF,gBAAM,SAAS,MAAM,KAAK,YAAY,IAAI;AAC1C,kBAAQ,KAAK,MAAM;AAAA,QACrB,SAAS,OAAY;AACnB,kBAAQ,KAAK;AAAA,YACX;AAAA,YACA,OAAO,MAAM;AAAA,UACf,CAAM;AAAA,QACR;AAAA,MACF;AAEA,YAAM,cAA2B;AAAA,QAC/B,SAAS;AAAA,QACT;AAAA,MACF;AAEA,kBAAY,YAAY,WAAW;AAAA,IACrC,SAAS,OAAY;AACnB,YAAM,cAA2B;AAAA,QAC/B,SAAS;AAAA,QACT,OAAO,MAAM;AAAA,QACb,SAAS,CAAC;AAAA,MACZ;AAEA,kBAAY,YAAY,WAAW;AAAA,IACrC,UAAE;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/workers/eslint.worker.ts"],
4
- "sourcesContent": ["import { ESLint } from 'eslint';\nimport { BaseWorker } from './base.worker';\nimport { WorkerConfig, WorkerResult } from '../types';\n\nclass ESLintWorker extends BaseWorker<WorkerConfig, WorkerResult> {\n private eslint: ESLint;\n\n constructor() {\n super();\n this.eslint = new ESLint({\n useEslintrc: false,\n fix: this.task.config.fix,\n overrideConfigFile: this.task.config.configPath\n });\n }\n\n protected async processFile(filePath: string): Promise<WorkerResult> {\n try {\n const results = await this.eslint.lintFiles([filePath]);\n const fileResult = results[0];\n\n // Apply fixes if requested\n if (this.task.config.fix && fileResult.output) {\n await ESLint.outputFixes(results);\n }\n return {\n file: filePath,\n warnings: fileResult.messages\n .filter(msg => msg.severity === 1)\n .map(warning => ({\n line: warning.line,\n column: warning.column,\n endColumn: warning.endColumn,\n message: warning.message,\n ruleId: warning.ruleId || 'unknown'\n })),\n errors: fileResult.messages\n .filter(msg => msg.severity === 2)\n .map(error => ({\n line: error.line,\n column: error.column,\n endColumn: error.endColumn,\n message: error.message,\n ruleId: error.ruleId || 'unknown'\n }))\n };\n } catch (error: any) {\n return {\n file: filePath,\n error: error.message\n };\n }\n }\n}\n\n// Initialize and start the worker\nconst worker = new ESLintWorker();\nworker.process().catch(error => {\n console.error('Worker failed:', error);\n process.exit(1);\n}); "],
5
- "mappings": ";AAAA,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAG3B,IAAM,eAAN,cAA2B,WAAuC;AAAA,EACxD;AAAA,EAER,cAAc;AACZ,UAAM;AACN,SAAK,SAAS,IAAI,OAAO;AAAA,MACvB,aAAa;AAAA,MACb,KAAK,KAAK,KAAK,OAAO;AAAA,MACtB,oBAAoB,KAAK,KAAK,OAAO;AAAA,IACvC,CAAC;AAAA,EACH;AAAA,EAEA,MAAgB,YAAY,UAAyC;AACnE,QAAI;AACF,YAAM,UAAU,MAAM,KAAK,OAAO,UAAU,CAAC,QAAQ,CAAC;AACtD,YAAM,aAAa,QAAQ,CAAC;AAG5B,UAAI,KAAK,KAAK,OAAO,OAAO,WAAW,QAAQ;AAC7C,cAAM,OAAO,YAAY,OAAO;AAAA,MAClC;AACA,aAAO;AAAA,QACL,MAAM;AAAA,QACN,UAAU,WAAW,SAClB,OAAO,SAAO,IAAI,aAAa,CAAC,EAChC,IAAI,cAAY;AAAA,UACf,MAAM,QAAQ;AAAA,UACd,QAAQ,QAAQ;AAAA,UAChB,WAAW,QAAQ;AAAA,UACnB,SAAS,QAAQ;AAAA,UACjB,QAAQ,QAAQ,UAAU;AAAA,QAC5B,EAAE;AAAA,QACJ,QAAQ,WAAW,SAChB,OAAO,SAAO,IAAI,aAAa,CAAC,EAChC,IAAI,YAAU;AAAA,UACb,MAAM,MAAM;AAAA,UACZ,QAAQ,MAAM;AAAA,UACd,WAAW,MAAM;AAAA,UACjB,SAAS,MAAM;AAAA,UACf,QAAQ,MAAM,UAAU;AAAA,QAC1B,EAAE;AAAA,MACN;AAAA,IACF,SAAS,OAAY;AACnB,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,MAAM;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;AAGA,IAAM,SAAS,IAAI,aAAa;AAChC,OAAO,QAAQ,EAAE,MAAM,WAAS;AAC9B,UAAQ,MAAM,kBAAkB,KAAK;AACrC,UAAQ,KAAK,CAAC;AAChB,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/workers/stylelint.worker.ts"],
4
- "sourcesContent": ["import stylelint from 'stylelint';\nimport { BaseWorker } from './base.worker';\nimport { WorkerConfig, WorkerResult } from '../types';\n\nclass StylelintWorker extends BaseWorker<WorkerConfig, WorkerResult> {\n protected async processFile(filePath: string): Promise<WorkerResult> {\n try {\n const options: stylelint.LinterOptions = {\n files: filePath,\n fix: this.task.config.fix,\n };\n\n // Load custom config if provided\n if (this.task.config.configPath) {\n options.configFile = this.task.config.configPath;\n }\n\n const result = await stylelint.lint(options);\n const fileResult = result.results[0];\n\n // Convert stylelint results to our format\n return {\n file: filePath,\n warnings: fileResult.warnings.map(warning => ({\n line: warning.line,\n column: warning.column,\n endColumn: warning.endColumn,\n message: warning.text,\n ruleId: warning.rule\n })),\n errors: [] // Stylelint doesn't differentiate between warnings and errors\n };\n } catch (error: any) {\n return {\n file: filePath,\n error: error.message\n };\n }\n }\n}\n\n// Initialize and start the worker\nconst worker = new StylelintWorker();\nworker.process().catch(error => {\n console.error('Worker failed:', error);\n process.exit(1);\n}); "],
5
- "mappings": ";AAAA,OAAO,eAAe;AACtB,SAAS,kBAAkB;AAG3B,IAAM,kBAAN,cAA8B,WAAuC;AAAA,EACnE,MAAgB,YAAY,UAAyC;AACnE,QAAI;AACF,YAAM,UAAmC;AAAA,QACvC,OAAO;AAAA,QACP,KAAK,KAAK,KAAK,OAAO;AAAA,MACxB;AAGA,UAAI,KAAK,KAAK,OAAO,YAAY;AAC/B,gBAAQ,aAAa,KAAK,KAAK,OAAO;AAAA,MACxC;AAEA,YAAM,SAAS,MAAM,UAAU,KAAK,OAAO;AAC3C,YAAM,aAAa,OAAO,QAAQ,CAAC;AAGnC,aAAO;AAAA,QACL,MAAM;AAAA,QACN,UAAU,WAAW,SAAS,IAAI,cAAY;AAAA,UAC5C,MAAM,QAAQ;AAAA,UACd,QAAQ,QAAQ;AAAA,UAChB,WAAW,QAAQ;AAAA,UACnB,SAAS,QAAQ;AAAA,UACjB,QAAQ,QAAQ;AAAA,QAClB,EAAE;AAAA,QACF,QAAQ,CAAC;AAAA;AAAA,MACX;AAAA,IACF,SAAS,OAAY;AACnB,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,MAAM;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;AAGA,IAAM,SAAS,IAAI,gBAAgB;AACnC,OAAO,QAAQ,EAAE,MAAM,WAAS;AAC9B,UAAQ,MAAM,kBAAkB,KAAK;AACrC,UAAQ,KAAK,CAAC;AAChB,CAAC;",
6
- "names": []
7
- }