tough-cookie 5.1.0-rc.0 → 5.1.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.
@@ -2,7 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.canonicalDomain = canonicalDomain;
4
4
  const constants_1 = require("./constants");
5
- const node_url_1 = require("node:url");
5
+ /**
6
+ * Normalizes a domain to lowercase and punycode-encoded.
7
+ * Runtime-agnostic equivalent to node's `domainToASCII`.
8
+ * @see https://nodejs.org/docs/latest-v22.x/api/url.html#urldomaintoasciidomain
9
+ */
10
+ function domainToASCII(domain) {
11
+ return new URL(`http://${domain}`).hostname;
12
+ }
6
13
  /**
7
14
  * Transforms a domain name into a canonical domain name. The canonical domain name is a domain name
8
15
  * that has been trimmed, lowercased, stripped of leading dot, and optionally punycode-encoded
@@ -46,12 +53,12 @@ function canonicalDomain(domainName) {
46
53
  if (!str.endsWith(']')) {
47
54
  str = str + ']';
48
55
  }
49
- return (0, node_url_1.domainToASCII)(str).slice(1, -1); // remove [ and ]
56
+ return domainToASCII(str).slice(1, -1); // remove [ and ]
50
57
  }
51
58
  // convert to IDN if any non-ASCII characters
52
59
  // eslint-disable-next-line no-control-regex
53
60
  if (/[^\u0001-\u007f]/.test(str)) {
54
- return (0, node_url_1.domainToASCII)(str);
61
+ return domainToASCII(str);
55
62
  }
56
63
  // ASCII-only domain - not canonicalized with new URL() because it may be a malformed URL
57
64
  return str.toLowerCase();
@@ -11,11 +11,11 @@
11
11
  * - `unsafe-disabled` - Disables cookie prefix checking.
12
12
  * @public
13
13
  */
14
- export declare const PrefixSecurityEnum: Readonly<{
15
- SILENT: "silent";
16
- STRICT: "strict";
17
- DISABLED: "unsafe-disabled";
18
- }>;
14
+ export declare const PrefixSecurityEnum: {
15
+ readonly SILENT: "silent";
16
+ readonly STRICT: "strict";
17
+ readonly DISABLED: "unsafe-disabled";
18
+ };
19
19
  export declare const IP_V6_REGEX_OBJECT: RegExp;
20
20
  /**
21
21
  * A JSON representation of a {@link CookieJar}.
@@ -14,11 +14,12 @@ exports.IP_V6_REGEX_OBJECT = exports.PrefixSecurityEnum = void 0;
14
14
  * - `unsafe-disabled` - Disables cookie prefix checking.
15
15
  * @public
16
16
  */
17
- exports.PrefixSecurityEnum = Object.freeze({
17
+ exports.PrefixSecurityEnum = {
18
18
  SILENT: 'silent',
19
19
  STRICT: 'strict',
20
20
  DISABLED: 'unsafe-disabled',
21
- });
21
+ };
22
+ Object.freeze(exports.PrefixSecurityEnum);
22
23
  const IP_V6_REGEX = `
23
24
  \\[?(?:
24
25
  (?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)|
@@ -1,16 +1,16 @@
1
- export { MemoryCookieStore, MemoryCookieStoreIndex } from '../memstore';
1
+ export { MemoryCookieStore, type MemoryCookieStoreIndex } from '../memstore';
2
2
  export { pathMatch } from '../pathMatch';
3
3
  export { permuteDomain } from '../permuteDomain';
4
- export { getPublicSuffix, GetPublicSuffixOptions } from '../getPublicSuffix';
4
+ export { getPublicSuffix, type GetPublicSuffixOptions, } from '../getPublicSuffix';
5
5
  export { Store } from '../store';
6
6
  export { ParameterError } from '../validators';
7
7
  export { version } from '../version';
8
- export { Callback, ErrorCallback, Nullable } from '../utils';
8
+ export { type Callback, type ErrorCallback, type Nullable } from '../utils';
9
9
  export { canonicalDomain } from './canonicalDomain';
10
- export { PrefixSecurityEnum, SerializedCookie, SerializedCookieJar, } from './constants';
11
- export { Cookie, CreateCookieOptions, ParseCookieOptions } from './cookie';
10
+ export { PrefixSecurityEnum, type SerializedCookie, type SerializedCookieJar, } from './constants';
11
+ export { Cookie, type CreateCookieOptions, type ParseCookieOptions, } from './cookie';
12
12
  export { cookieCompare } from './cookieCompare';
13
- export { CookieJar, CreateCookieJarOptions, GetCookiesOptions, SetCookieOptions, } from './cookieJar';
13
+ export { CookieJar, type CreateCookieJarOptions, type GetCookiesOptions, type SetCookieOptions, } from './cookieJar';
14
14
  export { defaultPath } from './defaultPath';
15
15
  export { domainMatch } from './domainMatch';
16
16
  export { formatDate } from './formatDate';
package/dist/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * The version of `tough-cookie`
3
3
  * @public
4
4
  */
5
- export declare const version = "5.1.0-rc.0";
5
+ export declare const version = "5.1.1";
package/dist/version.js CHANGED
@@ -5,4 +5,4 @@ exports.version = void 0;
5
5
  * The version of `tough-cookie`
6
6
  * @public
7
7
  */
8
- exports.version = '5.1.0-rc.0';
8
+ exports.version = '5.1.1';
package/package.json CHANGED
@@ -75,7 +75,7 @@
75
75
  "RFC6265",
76
76
  "RFC2965"
77
77
  ],
78
- "version": "5.1.0-rc.0",
78
+ "version": "5.1.1",
79
79
  "homepage": "https://github.com/salesforce/tough-cookie",
80
80
  "repository": {
81
81
  "type": "git",
@@ -124,7 +124,9 @@
124
124
  "@types/node": "^16.18.101",
125
125
  "async": "3.2.6",
126
126
  "eslint": "^9.9.1",
127
- "eslint-config-prettier": "^9.1.0",
127
+ "eslint-config-prettier": "^10.0.1",
128
+ "eslint-import-resolver-typescript": "^3.7.0",
129
+ "eslint-plugin-import": "^2.31.0",
128
130
  "eslint-plugin-prettier": "^5.2.1",
129
131
  "genversion": "^3.2.0",
130
132
  "globals": "^15.8.0",