@archoleat/reglib 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +33 -2
- package/index.d.ts +16 -87
- package/index.js +1 -1
- package/package.json +32 -42
package/README.md
CHANGED
@@ -4,19 +4,50 @@
|
|
4
4
|
![NPM Downloads](https://img.shields.io/npm/dm/%40archoleat%2Freglib)
|
5
5
|
![ESM](https://img.shields.io/badge/ESM-fe0)
|
6
6
|
![Provenance](https://img.shields.io/badge/Provenance-fo0)
|
7
|
-
![CodeQL](https://img.shields.io/github/actions/workflow/status/archoleat/reglib/codeql.yaml?label=CodeQL)
|
8
7
|
![Specs](https://img.shields.io/github/actions/workflow/status/archoleat/reglib/spec.yaml?label=Specs)
|
9
8
|
![Commitlint](https://img.shields.io/github/actions/workflow/status/archoleat/reglib/commitlint.yaml?label=Commitlint)
|
10
9
|
![Editorconfig](https://img.shields.io/github/actions/workflow/status/archoleat/reglib/editorconfig.yaml?label=Editorconfig)
|
11
10
|
![Prettier](https://img.shields.io/github/actions/workflow/status/archoleat/reglib/prettier.yaml?label=Prettier)
|
12
11
|
![ESLint](https://img.shields.io/github/actions/workflow/status/archoleat/reglib/eslint.yaml?label=ESLint)
|
13
|
-
![
|
12
|
+
![Remark](https://img.shields.io/github/actions/workflow/status/archoleat/reglib/remark.yaml?label=Remark)
|
14
13
|
|
15
14
|
## Table of Contents
|
16
15
|
|
16
|
+
- [Installation](#installtion)
|
17
|
+
- [List of Regex](#list-of-regex)
|
17
18
|
- [Contributing](#contributing)
|
18
19
|
- [License](#license)
|
19
20
|
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
```shell
|
24
|
+
bun i -D @archoleat/reglib
|
25
|
+
```
|
26
|
+
|
27
|
+
## List of Regex
|
28
|
+
|
29
|
+
- `FONT_FILE_NAME_REGEX`: Matches FontFamily-FontWeight.woff2
|
30
|
+
|
31
|
+
- `ITALIC_REGEX`: Searches for the words `Italic` or `italic`.
|
32
|
+
|
33
|
+
- `VARIABLE_FONT_REGEX`: Searches for the words `var` or `variable`.
|
34
|
+
|
35
|
+
- `selectors`
|
36
|
+
- `bem`
|
37
|
+
- `BLOCK_REGEX`
|
38
|
+
- `ELEMENT_REGEX`
|
39
|
+
- `MODIFIER_REGEX`
|
40
|
+
|
41
|
+
- `child`
|
42
|
+
- `ATTRIBUTE_REGEX`
|
43
|
+
- `CLASS_REGEX`
|
44
|
+
|
45
|
+
- `nested`
|
46
|
+
- `ATTRIBUTE_REGEX`
|
47
|
+
- `CLASS_REGEX`
|
48
|
+
- `ELEMENT_REGEX`
|
49
|
+
- `MODIFIER_REGEX`
|
50
|
+
|
20
51
|
## Contributing
|
21
52
|
|
22
53
|
Please read [**CONTRIBUTING**](https://github.com/archoleat/.github/blob/main/CONTRIBUTING.md)
|
package/index.d.ts
CHANGED
@@ -1,92 +1,21 @@
|
|
1
|
-
const
|
2
|
-
const FONT_FAMILY_REGEX = `^${LETTERS_REGEX}+(${LETTERS_REGEX}+)?`;
|
3
|
-
const ALLOWED_FONT_WEIGHT_REGEX = [
|
4
|
-
'Thin',
|
5
|
-
'Hairline',
|
6
|
-
'ExtraLight',
|
7
|
-
'UltraLight',
|
8
|
-
'Light',
|
9
|
-
'Regular',
|
10
|
-
'Medium',
|
11
|
-
'SemiBold',
|
12
|
-
'DemiBold',
|
13
|
-
'Bold',
|
14
|
-
'ExtraBold',
|
15
|
-
'UltraBold',
|
16
|
-
'Black',
|
17
|
-
'Heavy',
|
18
|
-
'ExtraBlack',
|
19
|
-
'UltraBlack',
|
20
|
-
].join('|');
|
21
|
-
const ALLOWED_FONT_EXTENSION_REGEX = ['otf', 'ttf', 'woff', 'woff2'].join('|');
|
22
|
-
const FAMILY_REGEX = `(${FONT_FAMILY_REGEX})`;
|
23
|
-
const WEIGHT_REGEX = `(${ALLOWED_FONT_WEIGHT_REGEX})`;
|
24
|
-
const EXTENSION_REGEX = `(${ALLOWED_FONT_EXTENSION_REGEX})$`;
|
25
|
-
const FONT_FILE_NAME_REGEX = new RegExp(
|
26
|
-
`${FAMILY_REGEX}-${WEIGHT_REGEX}\\.${EXTENSION_REGEX}`,
|
27
|
-
);
|
1
|
+
declare const FONT_FILE_NAME_REGEX: RegExp;
|
28
2
|
|
29
|
-
const
|
30
|
-
|
31
|
-
const ITALIC_REGEX = new RegExp(`${SPLIT_CHARS_REGEX}?(italic)`, 'i');
|
32
|
-
|
33
|
-
const VARIABLE_FONT_REGEX = new RegExp(`${SPLIT_CHARS_REGEX}?(var)`, 'i');
|
34
|
-
|
35
|
-
const EMAIL_REGEX = new RegExp(
|
36
|
-
String.raw`^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$`,
|
37
|
-
);
|
38
|
-
|
39
|
-
const LETTERS_WITH_SPACES_REGEX = new RegExp(String.raw`^[\sA-Za-zЁА-яё]+$`);
|
40
|
-
|
41
|
-
const NOT_SEPARATE_REGEX = new RegExp(String.raw`^\+[\d-]+$`);
|
42
|
-
|
43
|
-
const NOT_SPACE_REGEX = new RegExp(String.raw`^\S+$`, 'i');
|
44
|
-
|
45
|
-
const HTML_EXTENSION_REGEX = '.html';
|
46
|
-
const PUG_EXTENSION_REGEX = '.pug';
|
47
|
-
|
48
|
-
const extensions = {
|
49
|
-
HTML_EXTENSION_REGEX,
|
50
|
-
PUG_EXTENSION_REGEX,
|
51
|
-
FILE_EXTENSION_REGEX: new RegExp(String.raw`\.[^.]+$`),
|
52
|
-
JS_EXTENSION_REGEX: new RegExp(String.raw`\.js$`),
|
53
|
-
PUG_EXTENSION_REGEX_REGEX: new RegExp(`${PUG_EXTENSION_REGEX}$`),
|
54
|
-
SCSS_EXTENSION_REGEX: new RegExp(String.raw`\.s[ac]ss$`),
|
55
|
-
|
56
|
-
NODE_MODULES_REGEX: new RegExp('node_modules'),
|
57
|
-
};
|
58
|
-
|
59
|
-
const numbers = {
|
60
|
-
ALL_REGEX: new RegExp(String.raw`^\d+$`),
|
61
|
-
};
|
62
|
-
|
63
|
-
const phones = {
|
64
|
-
RU_REGEX: new RegExp(String.raw`^\+7 \((9\d{2,3})\) \d{3}-\d{2}-\d{2}$`),
|
65
|
-
US_REGEX: new RegExp(String.raw`^\+1 \((\d{3})\) \d{3}-\d{4}$`),
|
66
|
-
};
|
67
|
-
|
68
|
-
const SYMBOLS_REGEX = '[a-z0-9]';
|
69
|
-
const ATTRIBUTE_REGEX = String.raw`?\[(.*)\]`;
|
70
|
-
const CLASS_REGEX = String.raw`?\.(.*)`;
|
71
|
-
const MODIFIER_REGEX = '--';
|
72
|
-
const ELEMENT_REGEX = '__';
|
73
|
-
|
74
|
-
const selectors = {
|
3
|
+
declare const selectors: {
|
75
4
|
bem: {
|
76
|
-
BLOCK_REGEX:
|
77
|
-
ELEMENT_REGEX:
|
78
|
-
MODIFIER_REGEX:
|
79
|
-
}
|
80
|
-
nested: {
|
81
|
-
ATTRIBUTE_REGEX,
|
82
|
-
CLASS_REGEX,
|
83
|
-
ELEMENT_REGEX,
|
84
|
-
MODIFIER_REGEX,
|
85
|
-
},
|
5
|
+
BLOCK_REGEX: string;
|
6
|
+
ELEMENT_REGEX: string;
|
7
|
+
MODIFIER_REGEX: string;
|
8
|
+
};
|
86
9
|
child: {
|
87
|
-
ATTRIBUTE_REGEX:
|
88
|
-
CLASS_REGEX:
|
89
|
-
}
|
10
|
+
ATTRIBUTE_REGEX: string;
|
11
|
+
CLASS_REGEX: string;
|
12
|
+
};
|
13
|
+
nested: {
|
14
|
+
ATTRIBUTE_REGEX: string;
|
15
|
+
CLASS_REGEX: string;
|
16
|
+
ELEMENT_REGEX: string;
|
17
|
+
MODIFIER_REGEX: string;
|
18
|
+
};
|
90
19
|
};
|
91
20
|
|
92
|
-
export {
|
21
|
+
export { FONT_FILE_NAME_REGEX, selectors };
|
package/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
const
|
1
|
+
const c="(Italic)",G="(Variable)",t="[A-Z][a-z]",X=`^${t}+(${t}+)?`,T=["Thin","Hairline","ExtraLight","UltraLight","Light","Regular","Medium","SemiBold","DemiBold","Bold","ExtraBold","UltraBold","Black","Heavy","ExtraBlack","UltraBlack"].join("|"),$=["otf","ttf","woff","woff2"].join("|"),a=`(${X})`,s=`(${T})`,L=`(${$})$`,i=[`${a}-${s}`,`(${c}?)(${G}?)`,`\\.${L}`].join(""),l=new RegExp(i),E="[a-z0-9]",o=String.raw`?\[(.*)\]`,_=String.raw`?\.(.*)`,R="--",n="__",I={bem:{BLOCK_REGEX:`[a-z]${E}*(-${E}+)`,ELEMENT_REGEX:`(${n}${E}+(-${E}+)*)`,MODIFIER_REGEX:`(${R}${E}+(-${E}+)*)`},child:{ATTRIBUTE_REGEX:`${o} &`,CLASS_REGEX:`${_} &`},nested:{ATTRIBUTE_REGEX:o,CLASS_REGEX:_,ELEMENT_REGEX:n,MODIFIER_REGEX:R}};export{l as FONT_FILE_NAME_REGEX,I as selectors};
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@archoleat/reglib",
|
3
3
|
"description": "Library with ready-to-use regex",
|
4
|
-
"version": "1.
|
4
|
+
"version": "1.2.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": {
|
7
7
|
"email": "archoleat@gmail.com",
|
@@ -20,26 +20,22 @@
|
|
20
20
|
"archoleat-reglib",
|
21
21
|
"archoleat",
|
22
22
|
"library",
|
23
|
+
"plugin",
|
23
24
|
"ready-to-use",
|
24
25
|
"regex",
|
25
26
|
"reglib",
|
26
27
|
"regular-expression",
|
27
28
|
"regular-expressions"
|
28
29
|
],
|
29
|
-
"packageManager": "pnpm@9.
|
30
|
+
"packageManager": "pnpm@9.7.0",
|
30
31
|
"engines": {
|
31
32
|
"node": ">=20.0.0",
|
32
33
|
"pnpm": ">=9.0.0"
|
33
34
|
},
|
34
|
-
"volta": {
|
35
|
-
"node": "20.16.0",
|
36
|
-
"pnpm": "9.4.0"
|
37
|
-
},
|
38
35
|
"type": "module",
|
39
36
|
"imports": {
|
40
|
-
"#
|
41
|
-
"#
|
42
|
-
"#shared": "./src/shared/index.ts"
|
37
|
+
"#index": "./src/index.ts",
|
38
|
+
"#validators": "./src/validators/index.ts"
|
43
39
|
},
|
44
40
|
"exports": {
|
45
41
|
".": "./index.js",
|
@@ -50,56 +46,50 @@
|
|
50
46
|
"index.js"
|
51
47
|
],
|
52
48
|
"scripts": {
|
53
|
-
"init": "pnpm i && husky"
|
54
|
-
"spec": "vitest",
|
55
|
-
"spec:coverage": "vitest run --coverage",
|
56
|
-
"build": "rollup -c rollup.config.ts --configPlugin typescript",
|
57
|
-
"release": "semantic-release",
|
58
|
-
"lint:editorconfig": "editorconfig-checker",
|
59
|
-
"lint:formatting": "prettier . --check",
|
60
|
-
"lint:md": "remark . --quiet --frail",
|
61
|
-
"lint:ts": "eslint src/**/*.ts --fix",
|
62
|
-
"prettify": "prettier . --write",
|
63
|
-
"commit": "cz"
|
49
|
+
"init": "pnpm i && husky"
|
64
50
|
},
|
65
51
|
"devDependencies": {
|
66
|
-
"@archoleat/commitlint-define-config": "^1.0
|
67
|
-
"@archoleat/eslint-flat-compatibility": "^1.1
|
68
|
-
"@archoleat/
|
69
|
-
"@
|
70
|
-
"@commitlint/
|
71
|
-
"@commitlint/
|
72
|
-
"@
|
73
|
-
"@rollup/plugin-
|
52
|
+
"@archoleat/commitlint-define-config": "^1.1.0",
|
53
|
+
"@archoleat/eslint-flat-compatibility": "^1.2.1",
|
54
|
+
"@archoleat/prettier-define-config": "^1.1.0",
|
55
|
+
"@archoleat/semantic-release-define-config": "^1.2.0",
|
56
|
+
"@commitlint/cli": "^19.5.0",
|
57
|
+
"@commitlint/config-conventional": "^19.5.0",
|
58
|
+
"@commitlint/types": "^19.5.0",
|
59
|
+
"@rollup/plugin-alias": "^5.1.1",
|
60
|
+
"@rollup/plugin-typescript": "^12.1.1",
|
74
61
|
"@semantic-release/changelog": "^6.0.3",
|
75
62
|
"@semantic-release/git": "^10.0.1",
|
63
|
+
"@types/node": "^22.9.0",
|
76
64
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
77
65
|
"@typescript-eslint/parser": "^7.18.0",
|
78
|
-
"@vitest/coverage-v8": "^2.
|
66
|
+
"@vitest/coverage-v8": "^2.1.4",
|
79
67
|
"conventional-changelog-conventionalcommits": "^8.0.0",
|
80
|
-
"
|
81
|
-
"
|
82
|
-
"eslint": "^
|
68
|
+
"editorconfig-checker": "^6.0.0",
|
69
|
+
"eslint": "^8.57.1",
|
70
|
+
"eslint-config-airbnb": "^19.0.4",
|
83
71
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
84
72
|
"eslint-config-prettier": "^9.1.0",
|
85
73
|
"eslint-define-config": "^2.1.0",
|
86
|
-
"eslint-import-resolver-typescript": "^3.6.
|
87
|
-
"eslint-plugin-import": "^2.
|
88
|
-
"eslint-plugin-
|
89
|
-
"
|
90
|
-
"
|
91
|
-
"
|
74
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
75
|
+
"eslint-plugin-import": "^2.31.0",
|
76
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
77
|
+
"eslint-plugin-unicorn": "^56.0.0",
|
78
|
+
"git-pull-run": "^1.4.0",
|
79
|
+
"globals": "^15.12.0",
|
80
|
+
"husky": "^9.1.6",
|
81
|
+
"lint-staged": "^15.2.10",
|
92
82
|
"prettier": "^3.3.3",
|
93
83
|
"remark": "15.0.1",
|
94
84
|
"remark-cli": "^12.0.1",
|
95
85
|
"remark-preset-lint-consistent": "^6.0.0",
|
96
86
|
"remark-preset-lint-markdown-style-guide": "^6.0.0",
|
97
87
|
"remark-preset-lint-recommended": "^7.0.0",
|
98
|
-
"rollup": "^4.
|
88
|
+
"rollup": "^4.25.0",
|
99
89
|
"rollup-plugin-dts": "^6.1.1",
|
100
90
|
"rollup-plugin-esbuild": "^6.1.1",
|
101
|
-
"semantic-release": "^24.
|
102
|
-
"typescript": "^5.
|
103
|
-
"vitest": "^2.
|
91
|
+
"semantic-release": "^24.2.0",
|
92
|
+
"typescript": "^5.6.3",
|
93
|
+
"vitest": "^2.1.4"
|
104
94
|
}
|
105
95
|
}
|