@codacy/tools-markdownlint-0 0.3.0 → 0.5.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.js CHANGED
@@ -33,9 +33,10 @@ __export(index_exports, {
33
33
  default: () => index_default
34
34
  });
35
35
  module.exports = __toCommonJS(index_exports);
36
- var import_tooling = require("@codacy/tooling");
36
+ var import_tooling2 = require("@codacy/tooling");
37
37
 
38
38
  // src/adapter.ts
39
+ var import_tooling = require("@codacy/tooling");
39
40
  var import_path = __toESM(require("path"));
40
41
  var import_fs = __toESM(require("fs"));
41
42
 
@@ -757,6 +758,18 @@ var patterns_default = [
757
758
  }
758
759
  ];
759
760
 
761
+ // src/metadata.ts
762
+ var descriptor = {
763
+ id: "markdownlint",
764
+ displayName: "markdownlint",
765
+ preferredVersion: "0.37.4",
766
+ languages: ["Markdown"],
767
+ filePatterns: ["**/*.md", "**/*.markdown"],
768
+ supportedOS: ["linux", "darwin", "win32"],
769
+ supportedArch: ["x64", "arm64"],
770
+ supportedRunners: ["local", "container"]
771
+ };
772
+
760
773
  // src/adapter.ts
761
774
  var TOOL_ID = "markdownlint";
762
775
  var LOCAL_CONFIG_FILES = [
@@ -800,16 +813,9 @@ async function importMarkdownlintSync() {
800
813
  return import("markdownlint/sync");
801
814
  }
802
815
  var adapter = {
803
- id: TOOL_ID,
804
- displayName: "markdownlint",
805
- preferredVersion: "0.37.4",
816
+ ...descriptor,
806
817
  compatibleVersions: ">=0.30.0 <1.0.0",
807
818
  website: "https://github.com/DavidAnson/markdownlint",
808
- languages: ["Markdown"],
809
- filePatterns: ["**/*.md", "**/*.markdown"],
810
- supportedOS: ["linux", "darwin", "win32"],
811
- supportedArch: ["x64", "arm64"],
812
- supportedRunners: ["local", "container"],
813
819
  prerequisites: [],
814
820
  /**
815
821
  * Verifies that the `markdownlint` npm package is loadable and returns its
@@ -886,7 +892,7 @@ var adapter = {
886
892
  const absoluteFiles = ctx.targetFiles.map((f) => import_path.default.resolve(ctx.repositoryRoot, f));
887
893
  if (absoluteFiles.length === 0) {
888
894
  const completedAt2 = /* @__PURE__ */ new Date();
889
- return buildResult(startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
895
+ return (0, import_tooling.buildResult)(TOOL_ID, startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
890
896
  }
891
897
  let lintFn;
892
898
  let readConfigFn;
@@ -903,7 +909,7 @@ var adapter = {
903
909
  message: `Failed to load markdownlint: ${err instanceof Error ? err.message : String(err)}`,
904
910
  level: "error"
905
911
  });
906
- return buildResult(startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
912
+ return (0, import_tooling.buildResult)(TOOL_ID, startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
907
913
  }
908
914
  let inlineConfig;
909
915
  if (codacyConfig.useLocalConfigurationFile && codacyConfig.localConfigurationFile) {
@@ -924,7 +930,7 @@ var adapter = {
924
930
  ctx.logger.info("Skipping analysis: no local config and no patterns enabled", {
925
931
  toolId: TOOL_ID
926
932
  });
927
- return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
933
+ return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
928
934
  }
929
935
  const lintOptions = { files: absoluteFiles };
930
936
  if (inlineConfig !== void 0) {
@@ -981,29 +987,9 @@ var adapter = {
981
987
  errorCount: errors.length,
982
988
  durationMs: Date.now() - startMs
983
989
  });
984
- return buildResult(startedAt, completedAt, issues, errors, ctx.targetFiles.length);
990
+ return (0, import_tooling.buildResult)(TOOL_ID, startedAt, completedAt, issues, errors, ctx.targetFiles.length);
985
991
  }
986
992
  };
987
- function buildResult(startedAt, completedAt, issues, errors, filesAnalyzed) {
988
- const durationMs = completedAt.getTime() - startedAt.getTime();
989
- return {
990
- metadata: {
991
- startedAt: startedAt.toISOString(),
992
- completedAt: completedAt.toISOString(),
993
- durationMs
994
- },
995
- issues,
996
- errors,
997
- summary: {
998
- toolId: TOOL_ID,
999
- status: errors.some((e) => e.level === "error") ? "partial" : "success",
1000
- issueCount: issues.length,
1001
- errorCount: errors.length,
1002
- durationMs,
1003
- filesAnalyzed
1004
- }
1005
- };
1006
- }
1007
993
 
1008
994
  // src/index.ts
1009
- var index_default = (0, import_tooling.defineToolAdapter)(adapter);
995
+ var index_default = (0, import_tooling2.defineToolAdapter)(adapter);
@@ -0,0 +1,13 @@
1
+ import { AdapterDescriptor } from '@codacy/tooling';
2
+
3
+ /**
4
+ * Lightweight adapter descriptor for lazy loading.
5
+ *
6
+ * This module contains only plain-data metadata fields and has zero heavy
7
+ * imports (no patterns.json, no runtime utilities). The CLI imports this
8
+ * at startup for adapter registration without loading the full adapter module.
9
+ */
10
+
11
+ declare const descriptor: AdapterDescriptor;
12
+
13
+ export { descriptor };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/metadata.ts
21
+ var metadata_exports = {};
22
+ __export(metadata_exports, {
23
+ descriptor: () => descriptor
24
+ });
25
+ module.exports = __toCommonJS(metadata_exports);
26
+ var descriptor = {
27
+ id: "markdownlint",
28
+ displayName: "markdownlint",
29
+ preferredVersion: "0.37.4",
30
+ languages: ["Markdown"],
31
+ filePatterns: ["**/*.md", "**/*.markdown"],
32
+ supportedOS: ["linux", "darwin", "win32"],
33
+ supportedArch: ["x64", "arm64"],
34
+ supportedRunners: ["local", "container"]
35
+ };
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ descriptor
39
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/tools-markdownlint-0",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "markdownlint adapter — Library-mode Markdown linter",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "dependencies": {
11
11
  "markdownlint": "^0.37.4",
12
- "@codacy/tooling": "0.3.0"
12
+ "@codacy/tooling": "0.5.0"
13
13
  },
14
14
  "license": "MIT",
15
15
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",
@@ -22,8 +22,18 @@
22
22
  "engines": {
23
23
  "node": ">=20.0.0"
24
24
  },
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js"
29
+ },
30
+ "./metadata": {
31
+ "types": "./dist/metadata.d.ts",
32
+ "default": "./dist/metadata.js"
33
+ }
34
+ },
25
35
  "scripts": {
26
- "build": "tsup src/index.ts --format cjs --dts --clean",
36
+ "build": "tsup src/index.ts src/metadata.ts --format cjs --dts --clean",
27
37
  "test": "vitest run",
28
38
  "lint": "eslint src/",
29
39
  "clean": "rm -rf dist",