@commitlint/parse 20.3.1 → 20.4.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.
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -4
- package/lib/index.js.map +1 -1
- package/package.json +7 -8
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Parser } from "@commitlint/types";
|
|
2
|
-
import { type Commit, type
|
|
3
|
-
export declare function parse(message: string, parser?: Parser, parserOpts?:
|
|
2
|
+
import { type Commit, type ParserOptions } from "conventional-commits-parser";
|
|
3
|
+
export declare function parse(message: string, parser?: Parser, parserOpts?: ParserOptions): Promise<Commit>;
|
|
4
4
|
export default parse;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACN,KAAK,MAAM,EACX,KAAK,aAAa,EAElB,MAAM,6BAA6B,CAAC;AAgBrC,wBAAsB,KAAK,CAC1B,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAsB,EAC9B,UAAU,CAAC,EAAE,aAAa,GACxB,OAAO,CAAC,MAAM,CAAC,CAajB;AAED,eAAe,KAAK,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommitParser, } from "conventional-commits-parser";
|
|
2
2
|
// @ts-expect-error -- no typings
|
|
3
3
|
import defaultChangelogOpts from "conventional-changelog-angular";
|
|
4
|
-
|
|
4
|
+
const defaultParser = (message, options) => {
|
|
5
|
+
if (message === undefined || message === null) {
|
|
6
|
+
throw new TypeError("Expected a raw commit");
|
|
7
|
+
}
|
|
8
|
+
const parser = new CommitParser(options);
|
|
9
|
+
const result = parser.parse(message);
|
|
10
|
+
result.scope = result.scope ?? null;
|
|
11
|
+
result.subject = result.subject ?? null;
|
|
12
|
+
result.type = result.type ?? null;
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
export async function parse(message, parser = defaultParser, parserOpts) {
|
|
5
16
|
const preset = await defaultChangelogOpts();
|
|
6
|
-
const defaultOpts = preset.parserOpts;
|
|
17
|
+
const defaultOpts = preset.parser || preset.parserOpts;
|
|
18
|
+
// Support user-provided parser options passed either flat or nested under a 'parser' key
|
|
19
|
+
const userOpts = parserOpts?.parser || parserOpts || {};
|
|
7
20
|
const opts = {
|
|
8
21
|
...defaultOpts,
|
|
9
22
|
fieldPattern: null,
|
|
10
|
-
...
|
|
23
|
+
...userOpts,
|
|
11
24
|
};
|
|
12
25
|
const parsed = parser(message, opts);
|
|
13
26
|
parsed.raw = message;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAGN,YAAY,GACZ,MAAM,6BAA6B,CAAC;AACrC,iCAAiC;AACjC,OAAO,oBAAoB,MAAM,gCAAgC,CAAC;AAElE,MAAM,aAAa,GAAW,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IAClD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAC/C,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAC9C,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC;IACpC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC;IACxC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC;IAClC,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,KAAK,CAC1B,OAAe,EACf,SAAiB,aAAa,EAC9B,UAA0B;IAE1B,MAAM,MAAM,GAAG,MAAM,oBAAoB,EAAE,CAAC;IAC5C,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC;IACvD,yFAAyF;IACzF,MAAM,QAAQ,GAAI,UAAkB,EAAE,MAAM,IAAI,UAAU,IAAI,EAAE,CAAC;IACjE,MAAM,IAAI,GAAG;QACZ,GAAG,WAAW;QACd,YAAY,EAAE,IAAI;QAClB,GAAG,QAAQ;KACX,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,CAAW,CAAC;IAC/C,MAAM,CAAC,GAAG,GAAG,OAAO,CAAC;IACrB,OAAO,MAAM,CAAC;AACf,CAAC;AAED,eAAe,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/parse",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "20.
|
|
4
|
+
"version": "20.4.1",
|
|
5
5
|
"description": "Lint your commit messages",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -36,14 +36,13 @@
|
|
|
36
36
|
},
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@commitlint/test": "^20.
|
|
40
|
-
"@commitlint/utils": "^20.0.0"
|
|
41
|
-
"@types/conventional-commits-parser": "^5.0.0"
|
|
39
|
+
"@commitlint/test": "^20.4.0",
|
|
40
|
+
"@commitlint/utils": "^20.0.0"
|
|
42
41
|
},
|
|
43
42
|
"dependencies": {
|
|
44
|
-
"@commitlint/types": "^20.
|
|
45
|
-
"conventional-changelog-angular": "^
|
|
46
|
-
"conventional-commits-parser": "^
|
|
43
|
+
"@commitlint/types": "^20.4.0",
|
|
44
|
+
"conventional-changelog-angular": "^8.1.0",
|
|
45
|
+
"conventional-commits-parser": "^6.2.1"
|
|
47
46
|
},
|
|
48
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e7ae28d1f71299cedcafe3360f376c93800b283a"
|
|
49
48
|
}
|