@cluerise/tools 4.1.1 → 4.2.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/README.md CHANGED
@@ -8,7 +8,7 @@ _Tools for maintaining TypeScript projects_
8
8
 
9
9
  ```sh
10
10
  pnpm add -DE @cluerise/tools
11
- pnpm exec cluerise-tools init [all|name]
11
+ pnpm exec cluerise-tools init [all | name]
12
12
  ```
13
13
 
14
14
  Before you run the `init` command, make sure your `package.json` contains
@@ -19,13 +19,13 @@ Before you run the `init` command, make sure your `package.json` contains
19
19
  ### Lint
20
20
 
21
21
  ```sh
22
- cluerise-tools lint [all|fix|staged|commit]
22
+ cluerise-tools lint [all | fix | staged | commit]
23
23
  ```
24
24
 
25
25
  ### Release
26
26
 
27
27
  ```sh
28
- cluerise-tools release [create|extract-changelog]
28
+ cluerise-tools release [create | extract-changelog]
29
29
  ```
30
30
 
31
31
  ### Update Node.js versions
@@ -50,7 +50,7 @@ export default defineConfig([
50
50
  },
51
51
  {
52
52
  name: 'cluerise: typescript-eslint/disable-type-checked',
53
- files: ['**/*.js', '**/*.json', '**/*.jsonc', '**/*.yaml'],
53
+ files: ['**/*.html', '**/*.js', '**/*.json', '**/*.jsonc', '**/*.yaml'],
54
54
  extends: [typescriptEslint.configs.disableTypeChecked]
55
55
  },
56
56
  {
@@ -328,9 +328,6 @@ export default defineConfig([
328
328
  '**/.envrc.example',
329
329
  '**/.envrc.sample',
330
330
 
331
- // Shell scripts
332
- '**/*.sh',
333
-
334
331
  // Stryker
335
332
  '**/.stryker-tmp/',
336
333
 
@@ -1 +1,4 @@
1
1
  engineStrict: true
2
+
3
+ patchedDependencies:
4
+ semantic-release: patches/semantic-release.patch
@@ -2,6 +2,7 @@ export default {
2
2
  printWidth: 120,
3
3
  singleQuote: true,
4
4
  trailingComma: 'none',
5
+ plugins: ['prettier-plugin-sh'],
5
6
  overrides: [
6
7
  {
7
8
  files: '*.html',
@@ -21,17 +21,26 @@ export const defaultChangelogTypes = [
21
21
  { type: 'deps', scope: 'prod', section: 'Dependency updates' }
22
22
  ];
23
23
 
24
+ const getRepositoryUrl = (path) => {
25
+ const pathSegments = path.split('/');
26
+ const rootSegments = pathSegments.filter((segments) => segments.trim().length > 0).map(() => '..');
27
+
28
+ return `file://${process.cwd()}/${rootSegments.join('/')}`;
29
+ };
30
+
24
31
  export const createReleaseConfig = ({
25
32
  host,
26
33
  owner,
27
34
  repository,
35
+ path = '',
28
36
  releaseRules = defaultReleaseRules,
29
37
  changelogTypes = defaultChangelogTypes
30
38
  }) => ({
31
39
  branches: ['main'],
32
- repositoryUrl: `file://${process.cwd()}`,
40
+ repositoryUrl: getRepositoryUrl(path),
33
41
  preset: 'conventionalcommits',
34
42
  dryRun: true,
43
+ commitPath: path,
35
44
 
36
45
  plugins: [
37
46
  [
@@ -1,12 +1,3 @@
1
- var __typeError = (msg) => {
2
- throw TypeError(msg);
3
- };
4
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
- var _origins, _names, _data, _PackageJson_instances, parseGitRepository_fn, _nodeReleasesUrl;
10
1
  import SemVer from "semver";
11
2
  import FileSystem from "node:fs/promises";
12
3
  import { z } from "zod";
@@ -14,7 +5,9 @@ import { parse } from "smol-toml";
14
5
  const gitProviderOrigins = {
15
6
  github: "https://github.com"
16
7
  };
17
- const _GitProvider = class _GitProvider {
8
+ class GitProvider {
9
+ static #origins = gitProviderOrigins;
10
+ static #names = Object.keys(this.#origins);
18
11
  /**
19
12
  * Checks if the provided name is a valid Git provider name.
20
13
  *
@@ -22,7 +15,7 @@ const _GitProvider = class _GitProvider {
22
15
  * @returns True if the name is valid, false otherwise.
23
16
  */
24
17
  static isValidName(name) {
25
- return __privateGet(this, _names).includes(name);
18
+ return this.#names.includes(name);
26
19
  }
27
20
  /**
28
21
  * Returns a Git provider origin.
@@ -31,14 +24,9 @@ const _GitProvider = class _GitProvider {
31
24
  * @returns The origin URL of the Git provider.
32
25
  */
33
26
  static getOrigin(name) {
34
- return __privateGet(this, _origins)[name];
27
+ return this.#origins[name];
35
28
  }
36
- };
37
- _origins = new WeakMap();
38
- _names = new WeakMap();
39
- __privateAdd(_GitProvider, _origins, gitProviderOrigins);
40
- __privateAdd(_GitProvider, _names, Object.keys(__privateGet(_GitProvider, _origins)));
41
- let GitProvider = _GitProvider;
29
+ }
42
30
  const enginesSchema = z.object({
43
31
  node: z.string()
44
32
  });
@@ -55,11 +43,10 @@ const packageJsonDataSchema = z.object({
55
43
  engines: enginesSchema.optional(),
56
44
  repository: repositorySchema.optional()
57
45
  });
58
- const _PackageJson = class _PackageJson {
46
+ class PackageJson {
47
+ #data;
59
48
  constructor(data) {
60
- __privateAdd(this, _PackageJson_instances);
61
- __privateAdd(this, _data);
62
- __privateSet(this, _data, data);
49
+ this.#data = data;
63
50
  }
64
51
  static async init() {
65
52
  const content = await FileSystem.readFile("package.json", { encoding: "utf8" });
@@ -70,13 +57,13 @@ const _PackageJson = class _PackageJson {
70
57
  cause: parseResult.error
71
58
  });
72
59
  }
73
- return new _PackageJson(data);
60
+ return new PackageJson(data);
74
61
  }
75
62
  /**
76
63
  * Returns the required engines.
77
64
  */
78
65
  get engines() {
79
- return __privateGet(this, _data).engines;
66
+ return this.#data.engines;
80
67
  }
81
68
  /**
82
69
  * Sets the required engines.
@@ -84,13 +71,44 @@ const _PackageJson = class _PackageJson {
84
71
  * @param engines - The engines to set.
85
72
  */
86
73
  set engines(engines) {
87
- __privateGet(this, _data).engines = engines;
74
+ this.#data.engines = engines;
88
75
  }
89
76
  /**
90
77
  * Returns the repository information.
91
78
  */
92
79
  get repository() {
93
- return __privateGet(this, _data).repository;
80
+ return this.#data.repository;
81
+ }
82
+ #parseGitRepository(urlString) {
83
+ if (!urlString) {
84
+ return null;
85
+ }
86
+ const urlValue = urlString.includes(":") ? urlString : `https://${urlString}`;
87
+ const url = new URL(urlValue);
88
+ const scheme = url.protocol.slice(0, -1);
89
+ if (GitProvider.isValidName(scheme)) {
90
+ const [owner, repositoryName] = url.pathname.split("/");
91
+ if (!owner || !repositoryName) {
92
+ throw new Error("Unknown owner or repositoryName");
93
+ }
94
+ return {
95
+ origin: GitProvider.getOrigin(scheme),
96
+ owner,
97
+ repositoryName
98
+ };
99
+ }
100
+ if (scheme === "https") {
101
+ const [, owner, repositoryName] = url.pathname.split("/");
102
+ if (!owner || !repositoryName) {
103
+ throw new Error("Unknown owner or repositoryName");
104
+ }
105
+ return {
106
+ origin: url.origin,
107
+ owner,
108
+ repositoryName: repositoryName.endsWith(".git") ? repositoryName.slice(0, -4) : repositoryName
109
+ };
110
+ }
111
+ throw new Error("Unsupported repository URL");
94
112
  }
95
113
  /**
96
114
  * Parses the repository information from package.json.
@@ -102,52 +120,18 @@ const _PackageJson = class _PackageJson {
102
120
  return null;
103
121
  }
104
122
  if (typeof this.repository === "string") {
105
- return __privateMethod(this, _PackageJson_instances, parseGitRepository_fn).call(this, this.repository);
123
+ return this.#parseGitRepository(this.repository);
106
124
  }
107
- return __privateMethod(this, _PackageJson_instances, parseGitRepository_fn).call(this, this.repository.url);
125
+ return this.#parseGitRepository(this.repository.url);
108
126
  }
109
127
  /**
110
128
  * Saves the package.json file with the current data.
111
129
  */
112
130
  async save() {
113
- const content = JsonUtils.prettify(__privateGet(this, _data)) + "\n";
131
+ const content = JsonUtils.prettify(this.#data) + "\n";
114
132
  await FileSystem.writeFile("package.json", content, { encoding: "utf8" });
115
133
  }
116
- };
117
- _data = new WeakMap();
118
- _PackageJson_instances = new WeakSet();
119
- parseGitRepository_fn = function(urlString) {
120
- if (!urlString) {
121
- return null;
122
- }
123
- const urlValue = urlString.includes(":") ? urlString : `https://${urlString}`;
124
- const url = new URL(urlValue);
125
- const scheme = url.protocol.slice(0, -1);
126
- if (GitProvider.isValidName(scheme)) {
127
- const [owner, repositoryName] = url.pathname.split("/");
128
- if (!owner || !repositoryName) {
129
- throw new Error("Unknown owner or repositoryName");
130
- }
131
- return {
132
- origin: GitProvider.getOrigin(scheme),
133
- owner,
134
- repositoryName
135
- };
136
- }
137
- if (scheme === "https") {
138
- const [, owner, repositoryName] = url.pathname.split("/");
139
- if (!owner || !repositoryName) {
140
- throw new Error("Unknown owner or repositoryName");
141
- }
142
- return {
143
- origin: url.origin,
144
- owner,
145
- repositoryName: repositoryName.endsWith(".git") ? repositoryName.slice(0, -4) : repositoryName
146
- };
147
- }
148
- throw new Error("Unsupported repository URL");
149
- };
150
- let PackageJson = _PackageJson;
134
+ }
151
135
  const runMain = (main2) => {
152
136
  Promise.resolve().then(() => main2(process.argv.slice(2))).then((exitCode) => {
153
137
  process.exit(exitCode);
@@ -179,31 +163,29 @@ const herokuNodeReleasesSchema = z.object({
179
163
  releases: z.array(herokuNodeReleaseSchema)
180
164
  });
181
165
  class Heroku {
166
+ static #nodeReleasesUrl = "https://raw.githubusercontent.com/heroku/heroku-buildpack-nodejs/latest/inventory/node.toml";
182
167
  /**
183
168
  * Fetches supported Node.js releases on Heroku.
184
169
  *
185
170
  * @returns A promise that resolves to an array of HerokuNodeRelease objects.
186
171
  */
187
172
  static async fetchNodeReleases() {
188
- const response = await fetch(__privateGet(this, _nodeReleasesUrl));
173
+ const response = await fetch(this.#nodeReleasesUrl);
189
174
  const data = await response.text();
190
175
  const releasesData = parse(data);
191
176
  const { releases } = herokuNodeReleasesSchema.parse(releasesData);
192
177
  return releases;
193
178
  }
194
179
  }
195
- _nodeReleasesUrl = new WeakMap();
196
- __privateAdd(Heroku, _nodeReleasesUrl, "https://raw.githubusercontent.com/heroku/heroku-buildpack-nodejs/latest/inventory/node.toml");
197
180
  const getResultMessage = (nodeVersion, supported) => {
198
181
  const nodeVersionIsRange = SemVer.valid(nodeVersion) === null;
199
182
  const name = `Node.js version ${nodeVersionIsRange ? `range "${nodeVersion}"` : nodeVersion}`;
200
183
  return `${name} is ${supported ? "" : "not "}supported on Heroku`;
201
184
  };
202
185
  const main = async () => {
203
- var _a;
204
186
  try {
205
187
  const packageJson = await PackageJson.init();
206
- const nodeVersion = (_a = packageJson.engines) == null ? void 0 : _a.node;
188
+ const nodeVersion = packageJson.engines?.node;
207
189
  if (!nodeVersion) {
208
190
  console.error("Error: Node.js version is not specified in package.json");
209
191
  return 1;
@@ -1,12 +1,3 @@
1
- var __typeError = (msg) => {
2
- throw TypeError(msg);
3
- };
4
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
- var _config, _CommitLinter_instances, isValidEnumValue_fn, isValidType_fn, isValidScope_fn, _CommitLinter_static, parseSemanticCommitMessage_fn;
10
1
  import FileSystem from "node:fs/promises";
11
2
  import { z, ZodError } from "zod";
12
3
  import ChildProcess from "node:child_process";
@@ -76,11 +67,10 @@ class Git {
76
67
  }
77
68
  }
78
69
  }
79
- const _CommitLinter = class _CommitLinter {
70
+ class CommitLinter {
71
+ #config;
80
72
  constructor(config) {
81
- __privateAdd(this, _CommitLinter_instances);
82
- __privateAdd(this, _config);
83
- __privateSet(this, _config, config);
73
+ this.#config = config;
84
74
  }
85
75
  /**
86
76
  * Initializes the CommitLinter with the loaded commitlint configuration.
@@ -89,7 +79,7 @@ const _CommitLinter = class _CommitLinter {
89
79
  */
90
80
  static async init() {
91
81
  const config = await loadCommitlintConfig();
92
- return new _CommitLinter(config);
82
+ return new CommitLinter(config);
93
83
  }
94
84
  /**
95
85
  * Lints commit messages using commitlint.
@@ -101,6 +91,23 @@ const _CommitLinter = class _CommitLinter {
101
91
  const { status } = ChildProcess.spawnSync("commitlint", args, { stdio: "inherit" });
102
92
  return status ?? 0;
103
93
  }
94
+ #isValidEnumValue(ruleName, value) {
95
+ const rule = this.#config.rules[ruleName];
96
+ if (!rule) {
97
+ return true;
98
+ }
99
+ const [_severity, _condition, values] = rule;
100
+ if (!values) {
101
+ return true;
102
+ }
103
+ return values.includes(value);
104
+ }
105
+ #isValidType(type) {
106
+ return this.#isValidEnumValue("type-enum", type);
107
+ }
108
+ #isValidScope(scope) {
109
+ return this.#isValidEnumValue("scope-enum", scope);
110
+ }
104
111
  /**
105
112
  * Parses a semantic branch name into its type and scope.
106
113
  *
@@ -110,11 +117,11 @@ const _CommitLinter = class _CommitLinter {
110
117
  */
111
118
  parseSemanticBranchName(name) {
112
119
  const [typeValue, scopeValue] = name.split("-");
113
- if (!typeValue || !__privateMethod(this, _CommitLinter_instances, isValidType_fn).call(this, typeValue)) {
120
+ if (!typeValue || !this.#isValidType(typeValue)) {
114
121
  throw new Error("Invalid commit type in branch name");
115
122
  }
116
123
  const type = typeValue.toLowerCase();
117
- const scope = scopeValue && __privateMethod(this, _CommitLinter_instances, isValidScope_fn).call(this, scopeValue) ? scopeValue.toLowerCase() : null;
124
+ const scope = scopeValue && this.#isValidScope(scopeValue) ? scopeValue.toLowerCase() : null;
118
125
  return {
119
126
  type,
120
127
  scope
@@ -131,6 +138,12 @@ const _CommitLinter = class _CommitLinter {
131
138
  static stringifySemanticCommitMessagePrefix({ type, scope }) {
132
139
  return `${type}${scope ? `(${scope})` : ""}`;
133
140
  }
141
+ static #parseSemanticCommitMessage(message) {
142
+ const firstColonPosition = message.search(":");
143
+ const prefix = message.slice(0, firstColonPosition).trim();
144
+ const content = message.slice(firstColonPosition + 1).trim();
145
+ return { prefix, content };
146
+ }
134
147
  /**
135
148
  * Formats a semantic commit message by capitalizing the content after the prefix.
136
149
  *
@@ -138,7 +151,7 @@ const _CommitLinter = class _CommitLinter {
138
151
  * @returns The formatted commit message.
139
152
  */
140
153
  static formatSemanticCommitMessage(message) {
141
- const { prefix, content } = __privateMethod(this, _CommitLinter_static, parseSemanticCommitMessage_fn).call(this, message);
154
+ const { prefix, content } = this.#parseSemanticCommitMessage(message);
142
155
  if (!prefix || !content) {
143
156
  return message;
144
157
  }
@@ -162,35 +175,7 @@ const _CommitLinter = class _CommitLinter {
162
175
  }
163
176
  return commitMessage;
164
177
  }
165
- };
166
- _config = new WeakMap();
167
- _CommitLinter_instances = new WeakSet();
168
- isValidEnumValue_fn = function(ruleName, value) {
169
- const rule = __privateGet(this, _config).rules[ruleName];
170
- if (!rule) {
171
- return true;
172
- }
173
- const [_severity, _condition, values] = rule;
174
- if (!values) {
175
- return true;
176
- }
177
- return values.includes(value);
178
- };
179
- isValidType_fn = function(type) {
180
- return __privateMethod(this, _CommitLinter_instances, isValidEnumValue_fn).call(this, "type-enum", type);
181
- };
182
- isValidScope_fn = function(scope) {
183
- return __privateMethod(this, _CommitLinter_instances, isValidEnumValue_fn).call(this, "scope-enum", scope);
184
- };
185
- _CommitLinter_static = new WeakSet();
186
- parseSemanticCommitMessage_fn = function(message) {
187
- const firstColonPosition = message.search(":");
188
- const prefix = message.slice(0, firstColonPosition).trim();
189
- const content = message.slice(firstColonPosition + 1).trim();
190
- return { prefix, content };
191
- };
192
- __privateAdd(_CommitLinter, _CommitLinter_static);
193
- let CommitLinter = _CommitLinter;
178
+ }
194
179
  const commitMessagePathArgSchema = z.string();
195
180
  const parseCreateCommitMessageArgs = ([commitMessagePathArg]) => {
196
181
  const commitMessagePath = commitMessagePathArgSchema.parse(commitMessagePathArg);
@@ -1,12 +1,3 @@
1
- var __typeError = (msg) => {
2
- throw TypeError(msg);
3
- };
4
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
- var _config, _CommitLinter_instances, isValidEnumValue_fn, isValidType_fn, isValidScope_fn, _CommitLinter_static, parseSemanticCommitMessage_fn;
10
1
  import FileSystem from "node:fs/promises";
11
2
  import { z, ZodError } from "zod";
12
3
  import ChildProcess from "node:child_process";
@@ -53,11 +44,10 @@ class StringUtils {
53
44
  return `${firstLetter.toUpperCase()}${value.slice(1)}`;
54
45
  }
55
46
  }
56
- const _CommitLinter = class _CommitLinter {
47
+ class CommitLinter {
48
+ #config;
57
49
  constructor(config) {
58
- __privateAdd(this, _CommitLinter_instances);
59
- __privateAdd(this, _config);
60
- __privateSet(this, _config, config);
50
+ this.#config = config;
61
51
  }
62
52
  /**
63
53
  * Initializes the CommitLinter with the loaded commitlint configuration.
@@ -66,7 +56,7 @@ const _CommitLinter = class _CommitLinter {
66
56
  */
67
57
  static async init() {
68
58
  const config = await loadCommitlintConfig();
69
- return new _CommitLinter(config);
59
+ return new CommitLinter(config);
70
60
  }
71
61
  /**
72
62
  * Lints commit messages using commitlint.
@@ -78,6 +68,23 @@ const _CommitLinter = class _CommitLinter {
78
68
  const { status } = ChildProcess.spawnSync("commitlint", args, { stdio: "inherit" });
79
69
  return status ?? 0;
80
70
  }
71
+ #isValidEnumValue(ruleName, value) {
72
+ const rule = this.#config.rules[ruleName];
73
+ if (!rule) {
74
+ return true;
75
+ }
76
+ const [_severity, _condition, values] = rule;
77
+ if (!values) {
78
+ return true;
79
+ }
80
+ return values.includes(value);
81
+ }
82
+ #isValidType(type) {
83
+ return this.#isValidEnumValue("type-enum", type);
84
+ }
85
+ #isValidScope(scope) {
86
+ return this.#isValidEnumValue("scope-enum", scope);
87
+ }
81
88
  /**
82
89
  * Parses a semantic branch name into its type and scope.
83
90
  *
@@ -87,11 +94,11 @@ const _CommitLinter = class _CommitLinter {
87
94
  */
88
95
  parseSemanticBranchName(name) {
89
96
  const [typeValue, scopeValue] = name.split("-");
90
- if (!typeValue || !__privateMethod(this, _CommitLinter_instances, isValidType_fn).call(this, typeValue)) {
97
+ if (!typeValue || !this.#isValidType(typeValue)) {
91
98
  throw new Error("Invalid commit type in branch name");
92
99
  }
93
100
  const type = typeValue.toLowerCase();
94
- const scope = scopeValue && __privateMethod(this, _CommitLinter_instances, isValidScope_fn).call(this, scopeValue) ? scopeValue.toLowerCase() : null;
101
+ const scope = scopeValue && this.#isValidScope(scopeValue) ? scopeValue.toLowerCase() : null;
95
102
  return {
96
103
  type,
97
104
  scope
@@ -108,6 +115,12 @@ const _CommitLinter = class _CommitLinter {
108
115
  static stringifySemanticCommitMessagePrefix({ type, scope }) {
109
116
  return `${type}${scope ? `(${scope})` : ""}`;
110
117
  }
118
+ static #parseSemanticCommitMessage(message) {
119
+ const firstColonPosition = message.search(":");
120
+ const prefix = message.slice(0, firstColonPosition).trim();
121
+ const content = message.slice(firstColonPosition + 1).trim();
122
+ return { prefix, content };
123
+ }
111
124
  /**
112
125
  * Formats a semantic commit message by capitalizing the content after the prefix.
113
126
  *
@@ -115,7 +128,7 @@ const _CommitLinter = class _CommitLinter {
115
128
  * @returns The formatted commit message.
116
129
  */
117
130
  static formatSemanticCommitMessage(message) {
118
- const { prefix, content } = __privateMethod(this, _CommitLinter_static, parseSemanticCommitMessage_fn).call(this, message);
131
+ const { prefix, content } = this.#parseSemanticCommitMessage(message);
119
132
  if (!prefix || !content) {
120
133
  return message;
121
134
  }
@@ -139,35 +152,7 @@ const _CommitLinter = class _CommitLinter {
139
152
  }
140
153
  return commitMessage;
141
154
  }
142
- };
143
- _config = new WeakMap();
144
- _CommitLinter_instances = new WeakSet();
145
- isValidEnumValue_fn = function(ruleName, value) {
146
- const rule = __privateGet(this, _config).rules[ruleName];
147
- if (!rule) {
148
- return true;
149
- }
150
- const [_severity, _condition, values] = rule;
151
- if (!values) {
152
- return true;
153
- }
154
- return values.includes(value);
155
- };
156
- isValidType_fn = function(type) {
157
- return __privateMethod(this, _CommitLinter_instances, isValidEnumValue_fn).call(this, "type-enum", type);
158
- };
159
- isValidScope_fn = function(scope) {
160
- return __privateMethod(this, _CommitLinter_instances, isValidEnumValue_fn).call(this, "scope-enum", scope);
161
- };
162
- _CommitLinter_static = new WeakSet();
163
- parseSemanticCommitMessage_fn = function(message) {
164
- const firstColonPosition = message.search(":");
165
- const prefix = message.slice(0, firstColonPosition).trim();
166
- const content = message.slice(firstColonPosition + 1).trim();
167
- return { prefix, content };
168
- };
169
- __privateAdd(_CommitLinter, _CommitLinter_static);
170
- let CommitLinter = _CommitLinter;
155
+ }
171
156
  const commitMessagePathArgSchema = z.string();
172
157
  const parseFormatCommitMessageArgs = ([commitMessagePathArg]) => {
173
158
  const commitMessagePath = commitMessagePathArgSchema.parse(commitMessagePathArg);