@scaleway/regex 2.9.1 → 3.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/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 3.1.0 (2023-01-12)
7
+
8
+
9
+ ### :package: Chore
10
+
11
+ * **release:** publish ([22abd68](https://github.com/scaleway/scaleway-lib/commit/22abd687033bcd8c7cd187c8a9370c02fe7c0ef4))
12
+
13
+
14
+ ### :gear: Features
15
+
16
+ * **regex:** advanced domain regex for non ASCII characters ([#1156](https://github.com/scaleway/scaleway-lib/issues/1156)) ([6b896f8](https://github.com/scaleway/scaleway-lib/commit/6b896f824a773e0fa342357e11074551688429e3))
17
+
18
+
19
+
20
+ ## 3.0.0 (2023-01-06)
21
+
22
+
23
+ ### ⚠ BREAKING CHANGES
24
+
25
+ * packages are ESM only
26
+
27
+ ### :package: Chore
28
+
29
+ * **release:** publish ([20c9d4f](https://github.com/scaleway/scaleway-lib/commit/20c9d4fb39822245252bf362bc7a8d26127e511d))
30
+
31
+
32
+ ### :gear: Features
33
+
34
+ * publish packages as ESM only ([#1145](https://github.com/scaleway/scaleway-lib/issues/1145)) ([4c25097](https://github.com/scaleway/scaleway-lib/commit/4c25097254a5ba7f0a5dbb6fdf5d6578a75f777a))
35
+
36
+
37
+
6
38
  ## 2.9.1 (2022-12-29)
7
39
 
8
40
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -20,6 +20,7 @@ declare const ascii: RegExp;
20
20
  declare const backupKey: RegExp;
21
21
  declare const basicDomain: RegExp;
22
22
  declare const uppercaseBasicDomain: RegExp;
23
+ declare const advancedDomainName: RegExp;
23
24
  declare const cron: RegExp;
24
25
  declare const digits: RegExp;
25
26
  declare const macAddress: RegExp;
@@ -40,4 +41,4 @@ declare const ipv6Cidr: RegExp;
40
41
  declare const reverseDNS: RegExp;
41
42
  declare const dashedIpv4: RegExp;
42
43
 
43
- export { absoluteLinuxPath, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashLowercase, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdashunderscoredotsspacesparenthesis, alphanumdots, ascii, backupKey, basicDomain, cron, dashedIpv4, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, reverseDNS, s3BucketName, sixDigitsCode, spaces, uppercaseBasicDomain, url };
44
+ export { absoluteLinuxPath, advancedDomainName, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashLowercase, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdashunderscoredotsspacesparenthesis, alphanumdots, ascii, backupKey, basicDomain, cron, dashedIpv4, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, reverseDNS, s3BucketName, sixDigitsCode, spaces, uppercaseBasicDomain, url };
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ const ascii = /^[\x00-\x7F]+$/;
20
20
  const backupKey = /^[A-Z0-9]{32}$/;
21
21
  const basicDomain = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+$/;
22
22
  const uppercaseBasicDomain = /^(?![-])+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,63})+$/;
23
+ const advancedDomainName = /^(?:(?:(?:[a-zA-Z0-9À-ÖØ-öø-ÿ](?:[a-zA-Z0-9À-ÖØ-öø-ÿ-]{0,61}[a-zA-Z0-9À-ÖØ-öø-ÿ])?)\.)+[a-zA-Z]{2,}|(?:[0-9]{1,3}\.){3}[0-9]{1,3})(?::[\d]{1,5})?$/;
23
24
  const cron = /^((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$/;
24
25
  const digits = /^[0-9]*$/;
25
26
  const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
@@ -56,4 +57,4 @@ const ipv6Cidr = new RegExp(`^${cidrv6}$`);
56
57
  const reverseDNS = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+(\.)$/;
57
58
  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}/;
58
59
 
59
- export { absoluteLinuxPath, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashLowercase, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdashunderscoredotsspacesparenthesis, alphanumdots, ascii, backupKey, basicDomain, cron, dashedIpv4, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, reverseDNS, s3BucketName, sixDigitsCode, spaces, uppercaseBasicDomain, url };
60
+ export { absoluteLinuxPath, advancedDomainName, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashLowercase, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdashunderscoredotsspacesparenthesis, alphanumdots, ascii, backupKey, basicDomain, cron, dashedIpv4, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, reverseDNS, s3BucketName, sixDigitsCode, spaces, uppercaseBasicDomain, url };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@scaleway/regex",
3
- "version": "2.9.1",
3
+ "version": "3.1.0",
4
4
  "description": "A small utility to use regex",
5
5
  "type": "module",
6
+ "engines": {
7
+ "node": ">=14.x"
8
+ },
9
+ "sideEffects": false,
6
10
  "main": "dist/index.js",
7
11
  "module": "dist/index.js",
8
12
  "types": "dist/index.d.ts",
9
- "sideEffects": false,
10
- "browser": {
11
- "dist/index.js": "./dist/index.browser.js"
12
- },
13
13
  "publishConfig": {
14
14
  "access": "public"
15
15
  },
@@ -19,5 +19,5 @@
19
19
  "directory": "packages/regex"
20
20
  },
21
21
  "license": "MIT",
22
- "gitHead": "6f4e0715a61e04c1eae8e3ba28199ac99f47c818"
22
+ "gitHead": "9d6de7b63065f53774cb64b0e5a46a868dc9933a"
23
23
  }
@@ -1,59 +0,0 @@
1
- const alpha = /^[a-zA-Z]*$/;
2
- const alphaLower = /^[a-z]+$/;
3
- const alphanum = /^[a-zA-Z0-9]*$/;
4
- const alphaDashes = /^[a-zA-Z-]*$/;
5
- const alphanumdash = /^[a-zA-Z0-9-]*$/;
6
- const alphanumdashdots = /^[a-zA-Z0-9-.]*$/;
7
- const alphanumdashdotsorempty = /^$|^[a-zA-Z0-9-.]*$/;
8
- const alphanumdashdotsspaces = /^[a-zA-Z0-9-.\s]*$/;
9
- const alphanumdashunderscoredotsspacesparenthesis = /^[a-zA-Z0-9-_.()\s]*$/;
10
- const alphanumdashorempty = /^$|^[a-zA-Z0-9-]*$/;
11
- const alphanumdashspaces = /^[a-zA-Z0-9-\s]*$/;
12
- const alphanumdots = /^[a-zA-Z0-9.]*$/;
13
- const alphanumLowercase = /^[a-z0-9]+$/;
14
- const alphanumdashLowercase = /^[a-z0-9-]+$/;
15
- const alphanumSpacesDotsUnderscoreDash = /^[a-zA-Z0-9-.\s_]*$/;
16
- const alphanumUnderscoreDash = /^[a-zA-Z0-9_-]*$/;
17
- const alphanumUnderscoreDollarDash = /^[a-zA-Z0-9_$-]*$/;
18
- const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/;
19
- const ascii = /^[\x00-\x7F]+$/;
20
- const backupKey = /^[A-Z0-9]{32}$/;
21
- const basicDomain = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+$/;
22
- const uppercaseBasicDomain = /^(?![-])+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,63})+$/;
23
- const cron = /^((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$/;
24
- const digits = /^[0-9]*$/;
25
- const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
26
- const email = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
27
- const fourDigitsCode = /^[0-9]{4}$/;
28
- const phone = /^\+[0-9]*/;
29
- const spaces = /^\s*$/;
30
- const sixDigitsCode = /^[0-9]{6}$/;
31
- const url = /^http(s)?:\/\/?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/;
32
- const hexadecimal = /^[0-9a-fA-F]+$/;
33
- const s3BucketName = /^[a-z0-9][-.a-z0-9]{1,61}[a-z0-9]$/;
34
- 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}';
35
- const v6segment = '[a-fA-F\\d]{1,4}';
36
- const v6 = `
37
- (?:
38
- (?:${v6segment}:){7}(?:${v6segment}|:)|
39
- (?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)|
40
- (?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)|
41
- (?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)|
42
- (?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)|
43
- (?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)|
44
- (?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)|
45
- (?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:))
46
- )(?:%[0-9a-zA-Z]{1,})?
47
- `.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim();
48
- const cidrv4 = `${v4}\\/(3[0-2]|[12]?[0-9])`;
49
- const cidrv6 = `${v6}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`;
50
- const ip = new RegExp(`^(?:${v4}|${v6})$`);
51
- const ipv4 = new RegExp(`^${v4}$`);
52
- const ipv6 = new RegExp(`^${v6}$`);
53
- const ipCidr = new RegExp(`(?:^${cidrv4}$)|(?:^${cidrv6}$)`);
54
- const ipv4Cidr = new RegExp(`^${cidrv4}$`);
55
- const ipv6Cidr = new RegExp(`^${cidrv6}$`);
56
- const reverseDNS = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+(\.)$/;
57
- 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}/;
58
-
59
- export { absoluteLinuxPath, alpha, alphaDashes, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashLowercase, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdashunderscoredotsspacesparenthesis, alphanumdots, ascii, backupKey, basicDomain, cron, dashedIpv4, digits, email, fourDigitsCode, hexadecimal, ip, ipCidr, ipv4, ipv4Cidr, ipv6, ipv6Cidr, macAddress, phone, reverseDNS, s3BucketName, sixDigitsCode, spaces, uppercaseBasicDomain, url };