@html-validate/commitlint-config 4.1.3 → 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.
Files changed (2) hide show
  1. package/dist/commitlint.js +486 -432
  2. package/package.json +1 -1
@@ -18,6 +18,14 @@ var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? requir
18
18
  if (typeof require !== "undefined") return require.apply(this, arguments);
19
19
  throw Error('Dynamic require of "' + x2 + '" is not supported');
20
20
  });
21
+ var __esm = (fn, res, err) => function __init() {
22
+ if (err) throw err[0];
23
+ try {
24
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
25
+ } catch (e2) {
26
+ throw err = [e2], e2;
27
+ }
28
+ };
21
29
  var __commonJS = (cb, mod) => function __require2() {
22
30
  try {
23
31
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
@@ -2036,6 +2044,459 @@ var require_semver2 = __commonJS({
2036
2044
  }
2037
2045
  });
2038
2046
 
2047
+ // node_modules/conventional-commits-parser/dist/regex.js
2048
+ function escape2(string) {
2049
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2050
+ }
2051
+ function joinOr(parts) {
2052
+ return parts.map((val) => typeof val === "string" ? escape2(val.trim()) : val.source).filter(Boolean).join("|");
2053
+ }
2054
+ function getNotesRegex(noteKeywords, notesPattern) {
2055
+ if (!noteKeywords) {
2056
+ return nomatchRegex;
2057
+ }
2058
+ const noteKeywordsSelection = joinOr(noteKeywords);
2059
+ if (!notesPattern) {
2060
+ return new RegExp(`^[\\s|*]*(${noteKeywordsSelection})[:\\s]+(.*)`, "i");
2061
+ }
2062
+ return notesPattern(noteKeywordsSelection);
2063
+ }
2064
+ function getReferencePartsRegex(issuePrefixes, issuePrefixesCaseSensitive) {
2065
+ if (!issuePrefixes) {
2066
+ return nomatchRegex;
2067
+ }
2068
+ const flags = issuePrefixesCaseSensitive ? "g" : "gi";
2069
+ return new RegExp(`(?:.*?)??\\s*([\\w-\\.\\/]*?)??(${joinOr(issuePrefixes)})([\\w-]+)(?=\\s|$|[,;.)\\]])`, flags);
2070
+ }
2071
+ function getReferencesRegex(referenceActions) {
2072
+ if (!referenceActions) {
2073
+ return /()(.+)/gi;
2074
+ }
2075
+ const joinedKeywords = joinOr(referenceActions);
2076
+ return new RegExp(`(${joinedKeywords})(?:\\s+(.*?))(?=(?:${joinedKeywords})|$)`, "gi");
2077
+ }
2078
+ function getFooterTokenRegex(issuePrefixes) {
2079
+ const issuePrefixSeparator = issuePrefixes ? `|\\s+(?:${joinOr(issuePrefixes)})` : "";
2080
+ return new RegExp(`^\\s*(?:BREAKING CHANGE|[\\w-]+)(?::\\s+${issuePrefixSeparator}).+`, "i");
2081
+ }
2082
+ function getParserRegexes(options = {}) {
2083
+ const notes = getNotesRegex(options.noteKeywords, options.notesPattern);
2084
+ const referenceParts = getReferencePartsRegex(options.issuePrefixes, options.issuePrefixesCaseSensitive);
2085
+ const references = getReferencesRegex(options.referenceActions);
2086
+ const footerToken = getFooterTokenRegex(options.issuePrefixes);
2087
+ return {
2088
+ notes,
2089
+ referenceParts,
2090
+ references,
2091
+ footerToken,
2092
+ mentions: /@([\w-]+)/g,
2093
+ url: /\b(?:https?):\/\/(?:www\.)?([-a-zA-Z0-9@:%_+.~#?&//=])+\b/
2094
+ };
2095
+ }
2096
+ var nomatchRegex;
2097
+ var init_regex = __esm({
2098
+ "node_modules/conventional-commits-parser/dist/regex.js"() {
2099
+ nomatchRegex = /(?!.*)/;
2100
+ }
2101
+ });
2102
+
2103
+ // node_modules/conventional-commits-parser/dist/utils.js
2104
+ function trimNewLines(input) {
2105
+ const matches = input.match(/[^\r\n]/);
2106
+ if (typeof matches?.index !== "number") {
2107
+ return "";
2108
+ }
2109
+ const firstIndex = matches.index;
2110
+ let lastIndex = input.length - 1;
2111
+ while (input[lastIndex] === "\r" || input[lastIndex] === "\n") {
2112
+ lastIndex--;
2113
+ }
2114
+ return input.substring(firstIndex, lastIndex + 1);
2115
+ }
2116
+ function appendLine(src, line) {
2117
+ return src ? `${src}
2118
+ ${line || ""}` : line || "";
2119
+ }
2120
+ function getCommentFilter(char) {
2121
+ return char ? (line) => !line.startsWith(char) : () => true;
2122
+ }
2123
+ function truncateToScissor(lines, commentChar) {
2124
+ const scissorIndex = lines.indexOf(`${commentChar} ${SCISSOR}`);
2125
+ if (scissorIndex === -1) {
2126
+ return lines;
2127
+ }
2128
+ return lines.slice(0, scissorIndex);
2129
+ }
2130
+ function gpgFilter(line) {
2131
+ return !line.match(/^\s*gpg:/);
2132
+ }
2133
+ function assignMatchedCorrespondence(target, matches, correspondence) {
2134
+ const { groups } = matches;
2135
+ for (let i2 = 0, len = correspondence.length, key; i2 < len; i2++) {
2136
+ key = correspondence[i2];
2137
+ target[key] = (groups ? groups[key] : matches[i2 + 1]) || null;
2138
+ }
2139
+ return target;
2140
+ }
2141
+ var SCISSOR;
2142
+ var init_utils = __esm({
2143
+ "node_modules/conventional-commits-parser/dist/utils.js"() {
2144
+ SCISSOR = "------------------------ >8 ------------------------";
2145
+ }
2146
+ });
2147
+
2148
+ // node_modules/conventional-commits-parser/dist/options.js
2149
+ var defaultOptions;
2150
+ var init_options = __esm({
2151
+ "node_modules/conventional-commits-parser/dist/options.js"() {
2152
+ defaultOptions = {
2153
+ noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
2154
+ issuePrefixes: ["#"],
2155
+ referenceActions: [
2156
+ "close",
2157
+ "closes",
2158
+ "closed",
2159
+ "fix",
2160
+ "fixes",
2161
+ "fixed",
2162
+ "resolve",
2163
+ "resolves",
2164
+ "resolved"
2165
+ ],
2166
+ headerPattern: /^(\w*)(?:\(([\w$@.\-*/ ]*)\))?: (.*)$/,
2167
+ headerCorrespondence: [
2168
+ "type",
2169
+ "scope",
2170
+ "subject"
2171
+ ],
2172
+ revertPattern: /^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\.?/,
2173
+ revertCorrespondence: ["header", "hash"],
2174
+ fieldPattern: /^-(.*?)-$/
2175
+ };
2176
+ }
2177
+ });
2178
+
2179
+ // node_modules/conventional-commits-parser/dist/CommitParser.js
2180
+ function createCommitObject(initialData = {}) {
2181
+ return {
2182
+ merge: null,
2183
+ revert: null,
2184
+ header: null,
2185
+ body: null,
2186
+ footer: null,
2187
+ notes: [],
2188
+ mentions: [],
2189
+ references: [],
2190
+ ...initialData
2191
+ };
2192
+ }
2193
+ var CommitParser;
2194
+ var init_CommitParser = __esm({
2195
+ "node_modules/conventional-commits-parser/dist/CommitParser.js"() {
2196
+ init_regex();
2197
+ init_utils();
2198
+ init_options();
2199
+ CommitParser = class {
2200
+ options;
2201
+ regexes;
2202
+ lines = [];
2203
+ lineIndex = 0;
2204
+ commit = createCommitObject();
2205
+ constructor(options = {}) {
2206
+ this.options = {
2207
+ ...defaultOptions,
2208
+ ...options
2209
+ };
2210
+ this.regexes = getParserRegexes(this.options);
2211
+ }
2212
+ currentLine() {
2213
+ return this.lines[this.lineIndex];
2214
+ }
2215
+ nextLine() {
2216
+ return this.lines[this.lineIndex++];
2217
+ }
2218
+ isLineAvailable() {
2219
+ return this.lineIndex < this.lines.length;
2220
+ }
2221
+ parseReference(input, action) {
2222
+ const { regexes } = this;
2223
+ if (regexes.url.test(input)) {
2224
+ return null;
2225
+ }
2226
+ const matches = regexes.referenceParts.exec(input);
2227
+ if (!matches) {
2228
+ return null;
2229
+ }
2230
+ let [raw, repository = null, prefix2, issue] = matches;
2231
+ let owner = null;
2232
+ if (repository) {
2233
+ const slashIndex = repository.indexOf("/");
2234
+ if (slashIndex !== -1) {
2235
+ owner = repository.slice(0, slashIndex);
2236
+ repository = repository.slice(slashIndex + 1);
2237
+ }
2238
+ }
2239
+ return {
2240
+ raw,
2241
+ action,
2242
+ owner,
2243
+ repository,
2244
+ prefix: prefix2,
2245
+ issue
2246
+ };
2247
+ }
2248
+ parseReferences(input) {
2249
+ const { regexes } = this;
2250
+ const regex2 = input.match(regexes.references) ? regexes.references : /()(.+)/gi;
2251
+ const references = [];
2252
+ let matches;
2253
+ let action;
2254
+ let sentence;
2255
+ let reference2;
2256
+ while (true) {
2257
+ matches = regex2.exec(input);
2258
+ if (!matches) {
2259
+ break;
2260
+ }
2261
+ action = matches[1] || null;
2262
+ sentence = matches[2] || "";
2263
+ while (true) {
2264
+ reference2 = this.parseReference(sentence, action);
2265
+ if (!reference2) {
2266
+ break;
2267
+ }
2268
+ references.push(reference2);
2269
+ }
2270
+ }
2271
+ return references;
2272
+ }
2273
+ skipEmptyLines() {
2274
+ let line = this.currentLine();
2275
+ while (line !== void 0 && !line.trim()) {
2276
+ this.nextLine();
2277
+ line = this.currentLine();
2278
+ }
2279
+ }
2280
+ parseMerge() {
2281
+ const { commit, options } = this;
2282
+ const correspondence = options.mergeCorrespondence || [];
2283
+ const merge2 = this.currentLine();
2284
+ const matches = merge2 && options.mergePattern ? merge2.match(options.mergePattern) : null;
2285
+ if (matches) {
2286
+ this.nextLine();
2287
+ commit.merge = matches[0] || null;
2288
+ assignMatchedCorrespondence(commit, matches, correspondence);
2289
+ return true;
2290
+ }
2291
+ return false;
2292
+ }
2293
+ parseHeader(isMergeCommit) {
2294
+ if (isMergeCommit) {
2295
+ this.skipEmptyLines();
2296
+ }
2297
+ const { commit, options } = this;
2298
+ const correspondence = options.headerCorrespondence || [];
2299
+ const header = commit.header ?? this.nextLine();
2300
+ let matches = null;
2301
+ if (header) {
2302
+ if (options.breakingHeaderPattern) {
2303
+ matches = header.match(options.breakingHeaderPattern);
2304
+ }
2305
+ if (!matches && options.headerPattern) {
2306
+ matches = header.match(options.headerPattern);
2307
+ }
2308
+ }
2309
+ if (header) {
2310
+ commit.header = header;
2311
+ }
2312
+ if (matches) {
2313
+ assignMatchedCorrespondence(commit, matches, correspondence);
2314
+ }
2315
+ }
2316
+ parseMeta() {
2317
+ const { options, commit } = this;
2318
+ if (!options.fieldPattern || !this.isLineAvailable()) {
2319
+ return false;
2320
+ }
2321
+ let matches;
2322
+ let field = null;
2323
+ let parsed = false;
2324
+ while (this.isLineAvailable()) {
2325
+ matches = this.currentLine().match(options.fieldPattern);
2326
+ if (matches) {
2327
+ field = matches[1] || null;
2328
+ this.nextLine();
2329
+ continue;
2330
+ }
2331
+ if (field) {
2332
+ parsed = true;
2333
+ commit[field] = appendLine(commit[field], this.currentLine());
2334
+ this.nextLine();
2335
+ } else {
2336
+ break;
2337
+ }
2338
+ }
2339
+ return parsed;
2340
+ }
2341
+ parseNotes() {
2342
+ const { regexes, commit } = this;
2343
+ if (!this.isLineAvailable()) {
2344
+ return false;
2345
+ }
2346
+ const matches = this.currentLine().match(regexes.notes);
2347
+ let isFooterToken;
2348
+ if (matches) {
2349
+ const note = {
2350
+ title: matches[1],
2351
+ text: matches[2]
2352
+ };
2353
+ commit.notes.push(note);
2354
+ commit.footer = appendLine(commit.footer, this.currentLine());
2355
+ this.nextLine();
2356
+ while (this.isLineAvailable()) {
2357
+ if (this.parseMeta()) {
2358
+ return true;
2359
+ }
2360
+ if (this.parseNotes()) {
2361
+ return true;
2362
+ }
2363
+ isFooterToken = regexes.footerToken.test(this.currentLine());
2364
+ commit.references.push(...this.parseReferences(this.currentLine()));
2365
+ if (!isFooterToken) {
2366
+ note.text = appendLine(note.text, this.currentLine());
2367
+ }
2368
+ commit.footer = appendLine(commit.footer, this.currentLine());
2369
+ this.nextLine();
2370
+ if (isFooterToken) {
2371
+ break;
2372
+ }
2373
+ }
2374
+ return true;
2375
+ }
2376
+ return false;
2377
+ }
2378
+ parseBodyAndFooter(isBody) {
2379
+ const { commit, regexes } = this;
2380
+ if (!this.isLineAvailable()) {
2381
+ return isBody;
2382
+ }
2383
+ const isFooterToken = regexes.footerToken.test(this.currentLine());
2384
+ const isStillBody = !isFooterToken && isBody;
2385
+ commit.references.push(...this.parseReferences(this.currentLine()));
2386
+ if (isStillBody) {
2387
+ commit.body = appendLine(commit.body, this.currentLine());
2388
+ } else {
2389
+ commit.footer = appendLine(commit.footer, this.currentLine());
2390
+ }
2391
+ this.nextLine();
2392
+ return isStillBody;
2393
+ }
2394
+ parseBreakingHeader() {
2395
+ const { commit, options } = this;
2396
+ if (!options.breakingHeaderPattern || commit.notes.length || !commit.header) {
2397
+ return;
2398
+ }
2399
+ const matches = commit.header.match(options.breakingHeaderPattern);
2400
+ if (matches) {
2401
+ commit.notes.push({
2402
+ title: "BREAKING CHANGE",
2403
+ text: matches[3]
2404
+ });
2405
+ }
2406
+ }
2407
+ parseMentions(input) {
2408
+ const { commit, regexes } = this;
2409
+ let matches;
2410
+ for (; ; ) {
2411
+ matches = regexes.mentions.exec(input);
2412
+ if (!matches) {
2413
+ break;
2414
+ }
2415
+ commit.mentions.push(matches[1]);
2416
+ }
2417
+ }
2418
+ parseRevert(input) {
2419
+ const { commit, options } = this;
2420
+ const correspondence = options.revertCorrespondence || [];
2421
+ const matches = options.revertPattern ? input.match(options.revertPattern) : null;
2422
+ if (matches) {
2423
+ commit.revert = assignMatchedCorrespondence({}, matches, correspondence);
2424
+ }
2425
+ }
2426
+ cleanupCommit() {
2427
+ const { commit } = this;
2428
+ commit.body &&= trimNewLines(commit.body);
2429
+ commit.footer &&= trimNewLines(commit.footer);
2430
+ commit.notes.forEach((note) => {
2431
+ note.text = trimNewLines(note.text);
2432
+ });
2433
+ const referencesSet = /* @__PURE__ */ new Set();
2434
+ commit.references = commit.references.filter((reference2) => {
2435
+ const uid = `${reference2.action} ${reference2.raw}`.toLocaleLowerCase();
2436
+ const ok = !referencesSet.has(uid);
2437
+ if (ok) {
2438
+ referencesSet.add(uid);
2439
+ }
2440
+ return ok;
2441
+ });
2442
+ }
2443
+ /**
2444
+ * Parse commit message string into an object.
2445
+ * @param input - Commit message string.
2446
+ * @returns Commit object.
2447
+ */
2448
+ parse(input) {
2449
+ if (!input.trim()) {
2450
+ throw new TypeError("Expected a raw commit");
2451
+ }
2452
+ const { commentChar } = this.options;
2453
+ const commentFilter = getCommentFilter(commentChar);
2454
+ const rawLines = trimNewLines(input).split(/\r?\n/);
2455
+ const lines = commentChar ? truncateToScissor(rawLines, commentChar).filter((line) => commentFilter(line) && gpgFilter(line)) : rawLines.filter((line) => gpgFilter(line));
2456
+ const commit = createCommitObject();
2457
+ this.lines = lines;
2458
+ this.lineIndex = 0;
2459
+ this.commit = commit;
2460
+ const isMergeCommit = this.parseMerge();
2461
+ this.parseHeader(isMergeCommit);
2462
+ if (commit.header) {
2463
+ commit.references = this.parseReferences(commit.header);
2464
+ }
2465
+ let isBody = true;
2466
+ while (this.isLineAvailable()) {
2467
+ this.parseMeta();
2468
+ if (this.parseNotes()) {
2469
+ isBody = false;
2470
+ }
2471
+ if (!this.parseBodyAndFooter(isBody)) {
2472
+ isBody = false;
2473
+ }
2474
+ }
2475
+ this.parseBreakingHeader();
2476
+ this.parseMentions(input);
2477
+ this.parseRevert(input);
2478
+ this.cleanupCommit();
2479
+ return commit;
2480
+ }
2481
+ };
2482
+ }
2483
+ });
2484
+
2485
+ // node_modules/conventional-commits-parser/dist/stream.js
2486
+ var init_stream = __esm({
2487
+ "node_modules/conventional-commits-parser/dist/stream.js"() {
2488
+ init_CommitParser();
2489
+ }
2490
+ });
2491
+
2492
+ // node_modules/conventional-commits-parser/dist/index.js
2493
+ var init_dist = __esm({
2494
+ "node_modules/conventional-commits-parser/dist/index.js"() {
2495
+ init_CommitParser();
2496
+ init_stream();
2497
+ }
2498
+ });
2499
+
2039
2500
  // node_modules/ajv/dist/compile/codegen/code.js
2040
2501
  var require_code = __commonJS({
2041
2502
  "node_modules/ajv/dist/compile/codegen/code.js"(exports) {
@@ -15034,9 +15495,9 @@ var require_source_map_support = __commonJS({
15034
15495
  }
15035
15496
  });
15036
15497
 
15037
- // node_modules/typescript/lib/typescript.js
15498
+ // node_modules/@typescript/old/lib/typescript.js
15038
15499
  var require_typescript = __commonJS({
15039
- "node_modules/typescript/lib/typescript.js"(exports, module) {
15500
+ "node_modules/@typescript/old/lib/typescript.js"(exports, module) {
15040
15501
  var ts = {};
15041
15502
  ((module2) => {
15042
15503
  "use strict";
@@ -226566,6 +227027,13 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
226566
227027
  }
226567
227028
  });
226568
227029
 
227030
+ // node_modules/typescript/lib/typescript.js
227031
+ var require_typescript2 = __commonJS({
227032
+ "node_modules/typescript/lib/typescript.js"(exports, module) {
227033
+ module.exports = require_typescript();
227034
+ }
227035
+ });
227036
+
226569
227037
  // node_modules/cosmiconfig/dist/loaders.js
226570
227038
  var require_loaders = __commonJS({
226571
227039
  "node_modules/cosmiconfig/dist/loaders.js"(exports) {
@@ -226635,7 +227103,7 @@ ${error.message}`;
226635
227103
  var typescript;
226636
227104
  var loadTsSync = function loadTsSync2(filepath, content) {
226637
227105
  if (typescript === void 0) {
226638
- typescript = require_typescript();
227106
+ typescript = require_typescript2();
226639
227107
  }
226640
227108
  const compiledFilepath = `${filepath}.${(0, crypto_1.randomUUID)()}.cjs`;
226641
227109
  try {
@@ -226663,7 +227131,7 @@ ${error.message}`;
226663
227131
  exports.loadTsSync = loadTsSync;
226664
227132
  var loadTs = async function loadTs2(filepath, content) {
226665
227133
  if (typescript === void 0) {
226666
- typescript = (await Promise.resolve().then(() => __toESM(require_typescript()))).default;
227134
+ typescript = (await Promise.resolve().then(() => __toESM(require_typescript2()))).default;
226667
227135
  }
226668
227136
  const compiledFilepath = `${filepath}.${(0, crypto_1.randomUUID)()}.mjs`;
226669
227137
  let transpiledContent;
@@ -232731,420 +233199,8 @@ function isIgnored(commit = "", opts = {}) {
232731
233199
  return [...base, ...ignores].some((w2) => w2(commit));
232732
233200
  }
232733
233201
 
232734
- // node_modules/@commitlint/parse/node_modules/conventional-commits-parser/dist/regex.js
232735
- var nomatchRegex = /(?!.*)/;
232736
- function escape2(string) {
232737
- return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
232738
- }
232739
- function joinOr(parts) {
232740
- return parts.map((val) => typeof val === "string" ? escape2(val.trim()) : val.source).filter(Boolean).join("|");
232741
- }
232742
- function getNotesRegex(noteKeywords, notesPattern) {
232743
- if (!noteKeywords) {
232744
- return nomatchRegex;
232745
- }
232746
- const noteKeywordsSelection = joinOr(noteKeywords);
232747
- if (!notesPattern) {
232748
- return new RegExp(`^[\\s|*]*(${noteKeywordsSelection})[:\\s]+(.*)`, "i");
232749
- }
232750
- return notesPattern(noteKeywordsSelection);
232751
- }
232752
- function getReferencePartsRegex(issuePrefixes, issuePrefixesCaseSensitive) {
232753
- if (!issuePrefixes) {
232754
- return nomatchRegex;
232755
- }
232756
- const flags = issuePrefixesCaseSensitive ? "g" : "gi";
232757
- return new RegExp(`(?:.*?)??\\s*([\\w-\\.\\/]*?)??(${joinOr(issuePrefixes)})([\\w-]+)(?=\\s|$|[,;.)\\]])`, flags);
232758
- }
232759
- function getReferencesRegex(referenceActions) {
232760
- if (!referenceActions) {
232761
- return /()(.+)/gi;
232762
- }
232763
- const joinedKeywords = joinOr(referenceActions);
232764
- return new RegExp(`(${joinedKeywords})(?:\\s+(.*?))(?=(?:${joinedKeywords})|$)`, "gi");
232765
- }
232766
- function getFooterTokenRegex(issuePrefixes) {
232767
- const issuePrefixSeparator = issuePrefixes ? `|\\s+(?:${joinOr(issuePrefixes)})` : "";
232768
- return new RegExp(`^\\s*(?:BREAKING CHANGE|[\\w-]+)(?::\\s+${issuePrefixSeparator}).+`, "i");
232769
- }
232770
- function getParserRegexes(options = {}) {
232771
- const notes = getNotesRegex(options.noteKeywords, options.notesPattern);
232772
- const referenceParts = getReferencePartsRegex(options.issuePrefixes, options.issuePrefixesCaseSensitive);
232773
- const references = getReferencesRegex(options.referenceActions);
232774
- const footerToken = getFooterTokenRegex(options.issuePrefixes);
232775
- return {
232776
- notes,
232777
- referenceParts,
232778
- references,
232779
- footerToken,
232780
- mentions: /@([\w-]+)/g,
232781
- url: /\b(?:https?):\/\/(?:www\.)?([-a-zA-Z0-9@:%_+.~#?&//=])+\b/
232782
- };
232783
- }
232784
-
232785
- // node_modules/@commitlint/parse/node_modules/conventional-commits-parser/dist/utils.js
232786
- var SCISSOR = "------------------------ >8 ------------------------";
232787
- function trimNewLines(input) {
232788
- const matches = input.match(/[^\r\n]/);
232789
- if (typeof matches?.index !== "number") {
232790
- return "";
232791
- }
232792
- const firstIndex = matches.index;
232793
- let lastIndex = input.length - 1;
232794
- while (input[lastIndex] === "\r" || input[lastIndex] === "\n") {
232795
- lastIndex--;
232796
- }
232797
- return input.substring(firstIndex, lastIndex + 1);
232798
- }
232799
- function appendLine(src, line) {
232800
- return src ? `${src}
232801
- ${line || ""}` : line || "";
232802
- }
232803
- function getCommentFilter(char) {
232804
- return char ? (line) => !line.startsWith(char) : () => true;
232805
- }
232806
- function truncateToScissor(lines, commentChar) {
232807
- const scissorIndex = lines.indexOf(`${commentChar} ${SCISSOR}`);
232808
- if (scissorIndex === -1) {
232809
- return lines;
232810
- }
232811
- return lines.slice(0, scissorIndex);
232812
- }
232813
- function gpgFilter(line) {
232814
- return !line.match(/^\s*gpg:/);
232815
- }
232816
- function assignMatchedCorrespondence(target, matches, correspondence) {
232817
- const { groups } = matches;
232818
- for (let i2 = 0, len = correspondence.length, key; i2 < len; i2++) {
232819
- key = correspondence[i2];
232820
- target[key] = (groups ? groups[key] : matches[i2 + 1]) || null;
232821
- }
232822
- return target;
232823
- }
232824
-
232825
- // node_modules/@commitlint/parse/node_modules/conventional-commits-parser/dist/options.js
232826
- var defaultOptions = {
232827
- noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
232828
- issuePrefixes: ["#"],
232829
- referenceActions: [
232830
- "close",
232831
- "closes",
232832
- "closed",
232833
- "fix",
232834
- "fixes",
232835
- "fixed",
232836
- "resolve",
232837
- "resolves",
232838
- "resolved"
232839
- ],
232840
- headerPattern: /^(\w*)(?:\(([\w$@.\-*/ ]*)\))?: (.*)$/,
232841
- headerCorrespondence: [
232842
- "type",
232843
- "scope",
232844
- "subject"
232845
- ],
232846
- revertPattern: /^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\.?/,
232847
- revertCorrespondence: ["header", "hash"],
232848
- fieldPattern: /^-(.*?)-$/
232849
- };
232850
-
232851
- // node_modules/@commitlint/parse/node_modules/conventional-commits-parser/dist/CommitParser.js
232852
- function createCommitObject(initialData = {}) {
232853
- return {
232854
- merge: null,
232855
- revert: null,
232856
- header: null,
232857
- body: null,
232858
- footer: null,
232859
- notes: [],
232860
- mentions: [],
232861
- references: [],
232862
- ...initialData
232863
- };
232864
- }
232865
- var CommitParser = class {
232866
- options;
232867
- regexes;
232868
- lines = [];
232869
- lineIndex = 0;
232870
- commit = createCommitObject();
232871
- constructor(options = {}) {
232872
- this.options = {
232873
- ...defaultOptions,
232874
- ...options
232875
- };
232876
- this.regexes = getParserRegexes(this.options);
232877
- }
232878
- currentLine() {
232879
- return this.lines[this.lineIndex];
232880
- }
232881
- nextLine() {
232882
- return this.lines[this.lineIndex++];
232883
- }
232884
- isLineAvailable() {
232885
- return this.lineIndex < this.lines.length;
232886
- }
232887
- parseReference(input, action) {
232888
- const { regexes } = this;
232889
- if (regexes.url.test(input)) {
232890
- return null;
232891
- }
232892
- const matches = regexes.referenceParts.exec(input);
232893
- if (!matches) {
232894
- return null;
232895
- }
232896
- let [raw, repository = null, prefix2, issue] = matches;
232897
- let owner = null;
232898
- if (repository) {
232899
- const slashIndex = repository.indexOf("/");
232900
- if (slashIndex !== -1) {
232901
- owner = repository.slice(0, slashIndex);
232902
- repository = repository.slice(slashIndex + 1);
232903
- }
232904
- }
232905
- return {
232906
- raw,
232907
- action,
232908
- owner,
232909
- repository,
232910
- prefix: prefix2,
232911
- issue
232912
- };
232913
- }
232914
- parseReferences(input) {
232915
- const { regexes } = this;
232916
- const regex2 = input.match(regexes.references) ? regexes.references : /()(.+)/gi;
232917
- const references = [];
232918
- let matches;
232919
- let action;
232920
- let sentence;
232921
- let reference2;
232922
- while (true) {
232923
- matches = regex2.exec(input);
232924
- if (!matches) {
232925
- break;
232926
- }
232927
- action = matches[1] || null;
232928
- sentence = matches[2] || "";
232929
- while (true) {
232930
- reference2 = this.parseReference(sentence, action);
232931
- if (!reference2) {
232932
- break;
232933
- }
232934
- references.push(reference2);
232935
- }
232936
- }
232937
- return references;
232938
- }
232939
- skipEmptyLines() {
232940
- let line = this.currentLine();
232941
- while (line !== void 0 && !line.trim()) {
232942
- this.nextLine();
232943
- line = this.currentLine();
232944
- }
232945
- }
232946
- parseMerge() {
232947
- const { commit, options } = this;
232948
- const correspondence = options.mergeCorrespondence || [];
232949
- const merge2 = this.currentLine();
232950
- const matches = merge2 && options.mergePattern ? merge2.match(options.mergePattern) : null;
232951
- if (matches) {
232952
- this.nextLine();
232953
- commit.merge = matches[0] || null;
232954
- assignMatchedCorrespondence(commit, matches, correspondence);
232955
- return true;
232956
- }
232957
- return false;
232958
- }
232959
- parseHeader(isMergeCommit) {
232960
- if (isMergeCommit) {
232961
- this.skipEmptyLines();
232962
- }
232963
- const { commit, options } = this;
232964
- const correspondence = options.headerCorrespondence || [];
232965
- const header = commit.header ?? this.nextLine();
232966
- let matches = null;
232967
- if (header) {
232968
- if (options.breakingHeaderPattern) {
232969
- matches = header.match(options.breakingHeaderPattern);
232970
- }
232971
- if (!matches && options.headerPattern) {
232972
- matches = header.match(options.headerPattern);
232973
- }
232974
- }
232975
- if (header) {
232976
- commit.header = header;
232977
- }
232978
- if (matches) {
232979
- assignMatchedCorrespondence(commit, matches, correspondence);
232980
- }
232981
- }
232982
- parseMeta() {
232983
- const { options, commit } = this;
232984
- if (!options.fieldPattern || !this.isLineAvailable()) {
232985
- return false;
232986
- }
232987
- let matches;
232988
- let field = null;
232989
- let parsed = false;
232990
- while (this.isLineAvailable()) {
232991
- matches = this.currentLine().match(options.fieldPattern);
232992
- if (matches) {
232993
- field = matches[1] || null;
232994
- this.nextLine();
232995
- continue;
232996
- }
232997
- if (field) {
232998
- parsed = true;
232999
- commit[field] = appendLine(commit[field], this.currentLine());
233000
- this.nextLine();
233001
- } else {
233002
- break;
233003
- }
233004
- }
233005
- return parsed;
233006
- }
233007
- parseNotes() {
233008
- const { regexes, commit } = this;
233009
- if (!this.isLineAvailable()) {
233010
- return false;
233011
- }
233012
- const matches = this.currentLine().match(regexes.notes);
233013
- let isFooterToken;
233014
- if (matches) {
233015
- const note = {
233016
- title: matches[1],
233017
- text: matches[2]
233018
- };
233019
- commit.notes.push(note);
233020
- commit.footer = appendLine(commit.footer, this.currentLine());
233021
- this.nextLine();
233022
- while (this.isLineAvailable()) {
233023
- if (this.parseMeta()) {
233024
- return true;
233025
- }
233026
- if (this.parseNotes()) {
233027
- return true;
233028
- }
233029
- isFooterToken = regexes.footerToken.test(this.currentLine());
233030
- commit.references.push(...this.parseReferences(this.currentLine()));
233031
- if (!isFooterToken) {
233032
- note.text = appendLine(note.text, this.currentLine());
233033
- }
233034
- commit.footer = appendLine(commit.footer, this.currentLine());
233035
- this.nextLine();
233036
- if (isFooterToken) {
233037
- break;
233038
- }
233039
- }
233040
- return true;
233041
- }
233042
- return false;
233043
- }
233044
- parseBodyAndFooter(isBody) {
233045
- const { commit, regexes } = this;
233046
- if (!this.isLineAvailable()) {
233047
- return isBody;
233048
- }
233049
- const isFooterToken = regexes.footerToken.test(this.currentLine());
233050
- const isStillBody = !isFooterToken && isBody;
233051
- commit.references.push(...this.parseReferences(this.currentLine()));
233052
- if (isStillBody) {
233053
- commit.body = appendLine(commit.body, this.currentLine());
233054
- } else {
233055
- commit.footer = appendLine(commit.footer, this.currentLine());
233056
- }
233057
- this.nextLine();
233058
- return isStillBody;
233059
- }
233060
- parseBreakingHeader() {
233061
- const { commit, options } = this;
233062
- if (!options.breakingHeaderPattern || commit.notes.length || !commit.header) {
233063
- return;
233064
- }
233065
- const matches = commit.header.match(options.breakingHeaderPattern);
233066
- if (matches) {
233067
- commit.notes.push({
233068
- title: "BREAKING CHANGE",
233069
- text: matches[3]
233070
- });
233071
- }
233072
- }
233073
- parseMentions(input) {
233074
- const { commit, regexes } = this;
233075
- let matches;
233076
- for (; ; ) {
233077
- matches = regexes.mentions.exec(input);
233078
- if (!matches) {
233079
- break;
233080
- }
233081
- commit.mentions.push(matches[1]);
233082
- }
233083
- }
233084
- parseRevert(input) {
233085
- const { commit, options } = this;
233086
- const correspondence = options.revertCorrespondence || [];
233087
- const matches = options.revertPattern ? input.match(options.revertPattern) : null;
233088
- if (matches) {
233089
- commit.revert = assignMatchedCorrespondence({}, matches, correspondence);
233090
- }
233091
- }
233092
- cleanupCommit() {
233093
- const { commit } = this;
233094
- commit.body &&= trimNewLines(commit.body);
233095
- commit.footer &&= trimNewLines(commit.footer);
233096
- commit.notes.forEach((note) => {
233097
- note.text = trimNewLines(note.text);
233098
- });
233099
- const referencesSet = /* @__PURE__ */ new Set();
233100
- commit.references = commit.references.filter((reference2) => {
233101
- const uid = `${reference2.action} ${reference2.raw}`.toLocaleLowerCase();
233102
- const ok = !referencesSet.has(uid);
233103
- if (ok) {
233104
- referencesSet.add(uid);
233105
- }
233106
- return ok;
233107
- });
233108
- }
233109
- /**
233110
- * Parse commit message string into an object.
233111
- * @param input - Commit message string.
233112
- * @returns Commit object.
233113
- */
233114
- parse(input) {
233115
- if (!input.trim()) {
233116
- throw new TypeError("Expected a raw commit");
233117
- }
233118
- const { commentChar } = this.options;
233119
- const commentFilter = getCommentFilter(commentChar);
233120
- const rawLines = trimNewLines(input).split(/\r?\n/);
233121
- const lines = commentChar ? truncateToScissor(rawLines, commentChar).filter((line) => commentFilter(line) && gpgFilter(line)) : rawLines.filter((line) => gpgFilter(line));
233122
- const commit = createCommitObject();
233123
- this.lines = lines;
233124
- this.lineIndex = 0;
233125
- this.commit = commit;
233126
- const isMergeCommit = this.parseMerge();
233127
- this.parseHeader(isMergeCommit);
233128
- if (commit.header) {
233129
- commit.references = this.parseReferences(commit.header);
233130
- }
233131
- let isBody = true;
233132
- while (this.isLineAvailable()) {
233133
- this.parseMeta();
233134
- if (this.parseNotes()) {
233135
- isBody = false;
233136
- }
233137
- if (!this.parseBodyAndFooter(isBody)) {
233138
- isBody = false;
233139
- }
233140
- }
233141
- this.parseBreakingHeader();
233142
- this.parseMentions(input);
233143
- this.parseRevert(input);
233144
- this.cleanupCommit();
233145
- return commit;
233146
- }
233147
- };
233202
+ // node_modules/@commitlint/parse/lib/index.js
233203
+ init_dist();
233148
233204
 
233149
233205
  // node_modules/conventional-changelog-angular/src/parser.js
233150
233206
  function createParserOpts() {
@@ -235758,7 +235814,17 @@ function toArray(value) {
235758
235814
  // node_modules/@commitlint/read/node_modules/@conventional-changelog/git-client/dist/GitClient.js
235759
235815
  import { spawn } from "child_process";
235760
235816
 
235761
- // node_modules/@commitlint/read/node_modules/@simple-libs/stream-utils/dist/index.js
235817
+ // node_modules/@simple-libs/stream-utils/dist/index.js
235818
+ async function toArray2(iterable) {
235819
+ const result = [];
235820
+ for await (const item of iterable) {
235821
+ result.push(item);
235822
+ }
235823
+ return result;
235824
+ }
235825
+ async function concatBufferStream(iterable) {
235826
+ return Buffer.concat(await toArray2(iterable));
235827
+ }
235762
235828
  async function firstFromStream(stream) {
235763
235829
  for await (const tag of stream) {
235764
235830
  return tag;
@@ -235782,18 +235848,6 @@ async function* splitStream(stream, separator) {
235782
235848
  }
235783
235849
  }
235784
235850
 
235785
- // node_modules/@simple-libs/child-process-utils/node_modules/@simple-libs/stream-utils/dist/index.js
235786
- async function toArray2(iterable) {
235787
- const result = [];
235788
- for await (const item of iterable) {
235789
- result.push(item);
235790
- }
235791
- return result;
235792
- }
235793
- async function concatBufferStream(iterable) {
235794
- return Buffer.concat(await toArray2(iterable));
235795
- }
235796
-
235797
235851
  // node_modules/@simple-libs/child-process-utils/dist/index.js
235798
235852
  async function exitCode(process4) {
235799
235853
  if (process4.exitCode !== null) {
@@ -242353,7 +242407,7 @@ process.on("unhandledRejection", (reason, promise) => {
242353
242407
  });
242354
242408
  /*! Bundled license information:
242355
242409
 
242356
- typescript/lib/typescript.js:
242410
+ @typescript/old/lib/typescript.js:
242357
242411
  (*! *****************************************************************************
242358
242412
  Copyright (c) Microsoft Corporation. All rights reserved.
242359
242413
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/commitlint-config",
3
- "version": "4.1.3",
3
+ "version": "4.2.0",
4
4
  "description": "Commitlint sharable config used by the various HTML-validate packages",
5
5
  "keywords": [
6
6
  "commitlint"