@commitlint/is-ignored 19.7.1 → 19.8.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/defaults.d.ts +1 -1
- package/lib/defaults.d.ts.map +1 -1
- package/lib/defaults.js +4 -4
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/is-ignored.d.ts +1 -1
- package/lib/is-ignored.d.ts.map +1 -1
- package/lib/is-ignored.js +6 -15
- package/lib/is-ignored.js.map +1 -1
- package/package.json +6 -6
- package/lib/validate-ignore-func.d.ts +0 -3
- package/lib/validate-ignore-func.d.ts.map +0 -1
- package/lib/validate-ignore-func.js +0 -11
- package/lib/validate-ignore-func.js.map +0 -1
package/lib/defaults.d.ts
CHANGED
package/lib/defaults.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAe5C,eAAO,MAAM,SAAS,EAAE,OAAO,EAa9B,CAAC"}
|
package/lib/defaults.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import semver from
|
|
1
|
+
import semver from "semver";
|
|
2
2
|
const isSemver = (c) => {
|
|
3
|
-
const firstLine = c.split(
|
|
4
|
-
if (typeof firstLine !==
|
|
3
|
+
const firstLine = c.split("\n").shift();
|
|
4
|
+
if (typeof firstLine !== "string") {
|
|
5
5
|
return false;
|
|
6
6
|
}
|
|
7
|
-
const stripped = firstLine.replace(/^chore(\([^)]+\))?:/,
|
|
7
|
+
const stripped = firstLine.replace(/^chore(\([^)]+\))?:/, "").trim();
|
|
8
8
|
return semver.valid(stripped) !== null;
|
|
9
9
|
};
|
|
10
10
|
const test = (r) => r.test.bind(r);
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export { default } from
|
|
1
|
+
export * from "./is-ignored.js";
|
|
2
|
+
export { default } from "./is-ignored.js";
|
|
3
3
|
//# 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,cAAc,iBAAiB,CAAC;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export { default } from
|
|
1
|
+
export * from "./is-ignored.js";
|
|
2
|
+
export { default } from "./is-ignored.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
package/lib/is-ignored.d.ts
CHANGED
package/lib/is-ignored.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-ignored.d.ts","sourceRoot":"","sources":["../src/is-ignored.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"is-ignored.d.ts","sourceRoot":"","sources":["../src/is-ignored.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,CAAC,OAAO,UAAU,SAAS,CAChC,MAAM,GAAE,MAAW,EACnB,IAAI,GAAE,gBAAqB,GACzB,OAAO,CAqBT"}
|
package/lib/is-ignored.js
CHANGED
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
import { wildcards } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ignores = typeof opts.ignores === 'undefined' ? [] : opts.ignores;
|
|
1
|
+
import { wildcards } from "./defaults.js";
|
|
2
|
+
export default function isIgnored(commit = "", opts = {}) {
|
|
3
|
+
const ignores = typeof opts.ignores === "undefined" ? [] : opts.ignores;
|
|
5
4
|
if (!Array.isArray(ignores)) {
|
|
6
5
|
throw new Error(`ignores must be of type array, received ${ignores} of type ${typeof ignores}`);
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
ignores.forEach(validateIgnoreFunction);
|
|
10
|
-
const invalids = ignores.filter((c) => typeof c !== 'function');
|
|
7
|
+
const invalids = ignores.filter((c) => typeof c !== "function");
|
|
11
8
|
if (invalids.length > 0) {
|
|
12
9
|
throw new Error(`ignores must be array of type function, received items of type: ${invalids
|
|
13
10
|
.map((i) => typeof i)
|
|
14
|
-
.join(
|
|
11
|
+
.join(", ")}`);
|
|
15
12
|
}
|
|
16
13
|
const base = opts.defaults === false ? [] : wildcards;
|
|
17
|
-
return [...base, ...ignores].some((w) =>
|
|
18
|
-
const result = w(commit);
|
|
19
|
-
if (typeof result !== 'boolean') {
|
|
20
|
-
throw new Error(`Ignore function must return a boolean, received ${typeof result}`);
|
|
21
|
-
}
|
|
22
|
-
return result;
|
|
23
|
-
});
|
|
14
|
+
return [...base, ...ignores].some((w) => w(commit));
|
|
24
15
|
}
|
|
25
16
|
//# sourceMappingURL=is-ignored.js.map
|
package/lib/is-ignored.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-ignored.js","sourceRoot":"","sources":["../src/is-ignored.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"is-ignored.js","sourceRoot":"","sources":["../src/is-ignored.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,MAAM,CAAC,OAAO,UAAU,SAAS,CAChC,SAAiB,EAAE,EACnB,OAAyB,EAAE;IAE3B,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;IAExE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACd,2CAA2C,OAAO,YAAY,OAAO,OAAO,EAAE,CAC9E,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,UAAU,CAAC,CAAC;IAEhE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACd,mEAAmE,QAAQ;aACzE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;aACpB,IAAI,CAAC,IAAI,CAAC,EAAE,CACd,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/is-ignored",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "19.
|
|
4
|
+
"version": "19.8.1",
|
|
5
5
|
"description": "Lint your commit messages",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
},
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@commitlint/parse": "^19.
|
|
40
|
-
"@commitlint/test": "^19.
|
|
41
|
-
"@commitlint/utils": "^19.
|
|
39
|
+
"@commitlint/parse": "^19.8.1",
|
|
40
|
+
"@commitlint/test": "^19.8.1",
|
|
41
|
+
"@commitlint/utils": "^19.8.1",
|
|
42
42
|
"@types/semver": "^7.5.7"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@commitlint/types": "^19.
|
|
45
|
+
"@commitlint/types": "^19.8.1",
|
|
46
46
|
"semver": "^7.6.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "3c302008cabeb0b08cd246b2417a51a9d745a918"
|
|
49
49
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-ignore-func.d.ts","sourceRoot":"","sources":["../src/validate-ignore-func.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAE1C,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,OAAO,QAajD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function validateIgnoreFunction(fn) {
|
|
2
|
-
const fnString = fn.toString();
|
|
3
|
-
// Check for dangerous patterns
|
|
4
|
-
const dangerousPattern = /(?:process|require|import|eval|fetch|XMLHttpRequest|fs|child_process)(?:\s*\.|\s*\()|(?:exec|execFile|spawn)\s*\(/;
|
|
5
|
-
if (dangerousPattern.test(fnString)) {
|
|
6
|
-
// Find which pattern matched for a more specific error message
|
|
7
|
-
const match = fnString.match(dangerousPattern);
|
|
8
|
-
throw new Error(`Ignore function contains forbidden pattern: ${match?.[0].trim()}`);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=validate-ignore-func.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-ignore-func.js","sourceRoot":"","sources":["../src/validate-ignore-func.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CAAC,EAAW;IACjD,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE/B,+BAA+B;IAC/B,MAAM,gBAAgB,GACrB,mHAAmH,CAAC;IACrH,IAAI,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,+DAA+D;QAC/D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC/C,MAAM,IAAI,KAAK,CACd,+CAA+C,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAClE,CAAC;IACH,CAAC;AACF,CAAC"}
|