@scaleway/regex 5.0.0 → 5.1.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/.eslintignore ADDED
@@ -0,0 +1,4 @@
1
+ dist/
2
+ coverage/
3
+ node_modules
4
+ .reports/
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 5.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1960](https://github.com/scaleway/scaleway-lib/pull/1960) [`d034b3c`](https://github.com/scaleway/scaleway-lib/commit/d034b3cda1cac30ce2ed4e95be5a2c79642f8ca4) Thanks [@Slashgear](https://github.com/Slashgear)! - add legacy main attribut for CommonJS export usage
8
+
9
+ ## 5.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1943](https://github.com/scaleway/scaleway-lib/pull/1943) [`e726def`](https://github.com/scaleway/scaleway-lib/commit/e726def8e0cb4593f800f9acecca51b173ae907a) Thanks [@philibea](https://github.com/philibea)! - Migration from rollup to vite
14
+
3
15
  ## 5.0.0
4
16
 
5
17
  ### Major Changes
package/dist/index.d.ts CHANGED
@@ -1,49 +1,47 @@
1
- declare const accessKeyRegex: RegExp;
2
- declare const alpha: RegExp;
3
- declare const alphaLowercase: RegExp;
4
- declare const alphanum: RegExp;
5
- declare const alphaDashes: RegExp;
6
- declare const alphanumDash: RegExp;
7
- declare const alphanumDashDots: RegExp;
8
- declare const alphanumDashDotsOrEmpty: RegExp;
9
- declare const alphanumDashDotsSpaces: RegExp;
10
- declare const alphanumDashLowercase: RegExp;
11
- declare const alphanumDashSpaces: RegExp;
12
- declare const alphanumDashOrEmpty: RegExp;
13
- declare const alphanumDashUnderscoreDots: RegExp;
14
- declare const alphanumDashUnderscore: RegExp;
15
- declare const alphanumDashUnderscoreDotsSpacesParenthesis: RegExp;
16
- declare const alphanumDashUnderscoreDotsSpaces: RegExp;
17
- declare const alphanumDashUnderscoreDollar: RegExp;
18
- declare const alphanumDots: RegExp;
19
- declare const alphanumLowercase: RegExp;
20
- declare const absoluteLinuxPath: RegExp;
21
- declare const ascii: RegExp;
22
- declare const backupKey: RegExp;
23
- declare const basicDomain: RegExp;
24
- declare const uppercaseBasicDomain: RegExp;
25
- declare const uppercaseBasicSubdomain: RegExp;
26
- declare const advancedDomainName: RegExp;
27
- declare const cron: RegExp;
28
- declare const digits: RegExp;
29
- declare const macAddress: RegExp;
30
- declare const email: RegExp;
31
- declare const fourDigitsCode: RegExp;
32
- declare const phone: RegExp;
33
- declare const spaces: RegExp;
34
- declare const sixDigitsCode: RegExp;
35
- declare const url: RegExp;
36
- declare const hexadecimal: RegExp;
37
- declare const s3BucketName: RegExp;
38
- declare const ip: RegExp;
39
- declare const ipv4: RegExp;
40
- declare const ipv6: RegExp;
41
- declare const ipCidr: RegExp;
42
- declare const ipv4Cidr: RegExp;
43
- declare const ipv6Cidr: RegExp;
44
- declare const reverseDNS: RegExp;
45
- declare const dashedIpv4: RegExp;
46
- declare const pathSegment: RegExp;
47
- declare const absolutePath: RegExp;
48
-
49
- export { absoluteLinuxPath, absolutePath, accessKeyRegex, advancedDomainName, alpha, alphaDashes, alphaLowercase, alphanum, alphanumDash, alphanumDashDots, alphanumDashDotsOrEmpty, alphanumDashDotsSpaces, alphanumDashLowercase, alphanumDashOrEmpty, alphanumDashSpaces, alphanumDashUnderscore, alphanumDashUnderscoreDollar, alphanumDashUnderscoreDots, alphanumDashUnderscoreDotsSpaces, alphanumDashUnderscoreDotsSpacesParenthesis, alphanumDots, alphanumLowercase, ascii, backupKey, basicDomain, cron, dashedIpv4, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, pathSegment, phone, reverseDNS, s3BucketName, sixDigitsCode, spaces, uppercaseBasicDomain, uppercaseBasicSubdomain, url };
1
+ export declare const accessKeyRegex: RegExp;
2
+ export declare const alpha: RegExp;
3
+ export declare const alphaLowercase: RegExp;
4
+ export declare const alphanum: RegExp;
5
+ export declare const alphaDashes: RegExp;
6
+ export declare const alphanumDash: RegExp;
7
+ export declare const alphanumDashDots: RegExp;
8
+ export declare const alphanumDashDotsOrEmpty: RegExp;
9
+ export declare const alphanumDashDotsSpaces: RegExp;
10
+ export declare const alphanumDashLowercase: RegExp;
11
+ export declare const alphanumDashSpaces: RegExp;
12
+ export declare const alphanumDashOrEmpty: RegExp;
13
+ export declare const alphanumDashUnderscoreDots: RegExp;
14
+ export declare const alphanumDashUnderscore: RegExp;
15
+ export declare const alphanumDashUnderscoreDotsSpacesParenthesis: RegExp;
16
+ export declare const alphanumDashUnderscoreDotsSpaces: RegExp;
17
+ export declare const alphanumDashUnderscoreDollar: RegExp;
18
+ export declare const alphanumDots: RegExp;
19
+ export declare const alphanumLowercase: RegExp;
20
+ export declare const absoluteLinuxPath: RegExp;
21
+ export declare const ascii: RegExp;
22
+ export declare const backupKey: RegExp;
23
+ export declare const basicDomain: RegExp;
24
+ export declare const uppercaseBasicDomain: RegExp;
25
+ export declare const uppercaseBasicSubdomain: RegExp;
26
+ export declare const advancedDomainName: RegExp;
27
+ export declare const cron: RegExp;
28
+ export declare const digits: RegExp;
29
+ export declare const macAddress: RegExp;
30
+ export declare const email: RegExp;
31
+ export declare const fourDigitsCode: RegExp;
32
+ export declare const phone: RegExp;
33
+ export declare const spaces: RegExp;
34
+ export declare const sixDigitsCode: RegExp;
35
+ export declare const url: RegExp;
36
+ export declare const hexadecimal: RegExp;
37
+ export declare const s3BucketName: RegExp;
38
+ export declare const ip: RegExp;
39
+ export declare const ipv4: RegExp;
40
+ export declare const ipv6: RegExp;
41
+ export declare const ipCidr: RegExp;
42
+ export declare const ipv4Cidr: RegExp;
43
+ export declare const ipv6Cidr: RegExp;
44
+ export declare const reverseDNS: RegExp;
45
+ export declare const dashedIpv4: RegExp;
46
+ export declare const pathSegment: RegExp;
47
+ export declare const absolutePath: RegExp;
package/dist/index.js CHANGED
@@ -35,8 +35,8 @@ const sixDigitsCode = /^[0-9]{6}$/;
35
35
  const url = /^http(s)?:\/\/?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/;
36
36
  const hexadecimal = /^[0-9a-fA-F]+$/;
37
37
  const s3BucketName = /^[a-z0-9][-.a-z0-9]{1,61}[a-z0-9]$/;
38
- const v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}';
39
- const v6segment = '[a-fA-F\\d]{1,4}';
38
+ const v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
39
+ const v6segment = "[a-fA-F\\d]{1,4}";
40
40
  const v6 = `
41
41
  (?:
42
42
  (?:${v6segment}:){7}(?:${v6segment}|:)|
@@ -48,7 +48,7 @@ const v6 = `
48
48
  (?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)|
49
49
  (?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:))
50
50
  )(?:%[0-9a-zA-Z]{1,})?
51
- `.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim();
51
+ `.replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
52
52
  const cidrv4 = `${v4}\\/(3[0-2]|[12]?[0-9])`;
53
53
  const cidrv6 = `${v6}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`;
54
54
  const ip = new RegExp(`^(?:${v4}|${v6})$`);
@@ -61,5 +61,52 @@ const reverseDNS = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+(\.)$/;
61
61
  const dashedIpv4 = /(\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(-(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/;
62
62
  const pathSegment = /^[_a-zA-Z0-9]([-_.a-zA-Z0-9]*[_a-zA-Z0-9])?$/;
63
63
  const absolutePath = /^\/(([\w. -]*)[^\s?]\/?)+$/;
64
-
65
- export { absoluteLinuxPath, absolutePath, accessKeyRegex, advancedDomainName, alpha, alphaDashes, alphaLowercase, alphanum, alphanumDash, alphanumDashDots, alphanumDashDotsOrEmpty, alphanumDashDotsSpaces, alphanumDashLowercase, alphanumDashOrEmpty, alphanumDashSpaces, alphanumDashUnderscore, alphanumDashUnderscoreDollar, alphanumDashUnderscoreDots, alphanumDashUnderscoreDotsSpaces, alphanumDashUnderscoreDotsSpacesParenthesis, alphanumDots, alphanumLowercase, ascii, backupKey, basicDomain, cron, dashedIpv4, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, pathSegment, phone, reverseDNS, s3BucketName, sixDigitsCode, spaces, uppercaseBasicDomain, uppercaseBasicSubdomain, url };
64
+ export {
65
+ absoluteLinuxPath,
66
+ absolutePath,
67
+ accessKeyRegex,
68
+ advancedDomainName,
69
+ alpha,
70
+ alphaDashes,
71
+ alphaLowercase,
72
+ alphanum,
73
+ alphanumDash,
74
+ alphanumDashDots,
75
+ alphanumDashDotsOrEmpty,
76
+ alphanumDashDotsSpaces,
77
+ alphanumDashLowercase,
78
+ alphanumDashOrEmpty,
79
+ alphanumDashSpaces,
80
+ alphanumDashUnderscore,
81
+ alphanumDashUnderscoreDollar,
82
+ alphanumDashUnderscoreDots,
83
+ alphanumDashUnderscoreDotsSpaces,
84
+ alphanumDashUnderscoreDotsSpacesParenthesis,
85
+ alphanumDots,
86
+ alphanumLowercase,
87
+ ascii,
88
+ backupKey,
89
+ basicDomain,
90
+ cron,
91
+ dashedIpv4,
92
+ digits,
93
+ email,
94
+ fourDigitsCode,
95
+ hexadecimal,
96
+ ip,
97
+ ipCidr,
98
+ ipv4,
99
+ ipv4Cidr,
100
+ ipv6,
101
+ ipv6Cidr,
102
+ macAddress,
103
+ pathSegment,
104
+ phone,
105
+ reverseDNS,
106
+ s3BucketName,
107
+ sixDigitsCode,
108
+ spaces,
109
+ uppercaseBasicDomain,
110
+ uppercaseBasicSubdomain,
111
+ url
112
+ };
package/package.json CHANGED
@@ -1,15 +1,21 @@
1
1
  {
2
2
  "name": "@scaleway/regex",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "A small utility to use regex",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=20.x"
8
8
  },
9
+ "main": "./dist/index.cjs",
9
10
  "sideEffects": false,
11
+ "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
10
13
  "exports": {
11
- "types": "./dist/index.d.ts",
12
- "default": "./dist/index.js"
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "require": "./dist/index.cjs",
17
+ "default": "./dist/index.js"
18
+ }
13
19
  },
14
20
  "publishConfig": {
15
21
  "access": "public"
@@ -19,5 +25,14 @@
19
25
  "url": "https://github.com/scaleway/scaleway-lib",
20
26
  "directory": "packages/regex"
21
27
  },
22
- "license": "MIT"
28
+ "license": "MIT",
29
+ "scripts": {
30
+ "typecheck": "tsc --noEmit",
31
+ "type:generate": "tsc --declaration -p tsconfig.build.json",
32
+ "build": "vite build --config vite.config.ts && pnpm run type:generate",
33
+ "build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
34
+ "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .",
35
+ "test:unit": "vitest --run --config vite.config.ts",
36
+ "test:unit:coverage": "pnpm test:unit --coverage"
37
+ }
23
38
  }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "emitDeclarationOnly": true,
6
+ "rootDir": "src",
7
+ "outDir": "dist"
8
+ },
9
+ "exclude": [
10
+ "*.config.ts",
11
+ "*.setup.ts",
12
+ "**/__tests__",
13
+ "**/__mocks__",
14
+ "src/**/*.test.tsx"
15
+ ]
16
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "include": ["src/**/*.ts", "src/**/*.tsx", "*.config.ts"]
4
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { defineConfig, mergeConfig } from 'vite'
2
+ import { defaultConfig } from '../../vite.config'
3
+
4
+ export default mergeConfig(defineConfig(defaultConfig), {
5
+ build: {
6
+ target: ['node20'],
7
+ },
8
+ })