step-node-agent 3.26.3 → 3.26.5
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/node_modules/call-bind/CHANGELOG.md +13 -0
- package/node_modules/call-bind/index.js +6 -17
- package/node_modules/call-bind/package.json +14 -16
- package/node_modules/call-bind/test/index.js +4 -10
- package/node_modules/call-bind-apply-helpers/.eslintrc +16 -0
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +23 -0
- package/node_modules/{has-proto → call-bind-apply-helpers}/LICENSE +1 -1
- package/node_modules/call-bind-apply-helpers/README.md +62 -0
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/node_modules/call-bind-apply-helpers/index.d.ts +46 -0
- package/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
- package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
- package/node_modules/{has-proto → dunder-proto}/.github/FUNDING.yml +1 -1
- package/node_modules/dunder-proto/.nycrc +13 -0
- package/node_modules/dunder-proto/CHANGELOG.md +15 -0
- package/node_modules/dunder-proto/LICENSE +21 -0
- package/node_modules/dunder-proto/README.md +54 -0
- package/node_modules/dunder-proto/get.d.ts +5 -0
- package/node_modules/dunder-proto/get.js +23 -0
- package/node_modules/{has-proto → dunder-proto}/package.json +34 -36
- package/node_modules/dunder-proto/set.d.ts +5 -0
- package/node_modules/dunder-proto/set.js +29 -0
- package/node_modules/dunder-proto/test/get.js +34 -0
- package/node_modules/dunder-proto/test/index.js +4 -0
- package/node_modules/dunder-proto/test/set.js +41 -0
- package/node_modules/dunder-proto/tsconfig.json +9 -0
- package/node_modules/es-define-property/CHANGELOG.md +14 -0
- package/node_modules/es-define-property/index.js +1 -3
- package/node_modules/es-define-property/package.json +12 -12
- package/node_modules/es-define-property/test/index.js +1 -0
- package/node_modules/es-define-property/tsconfig.json +2 -42
- package/node_modules/express/History.md +10 -1
- package/node_modules/express/package.json +6 -2
- package/node_modules/get-intrinsic/CHANGELOG.md +18 -0
- package/node_modules/get-intrinsic/index.js +20 -20
- package/node_modules/get-intrinsic/package.json +21 -19
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +2 -2
- package/node_modules/gopd/CHANGELOG.md +20 -0
- package/node_modules/gopd/gOPD.d.ts +1 -0
- package/node_modules/gopd/gOPD.js +4 -0
- package/node_modules/gopd/index.d.ts +5 -0
- package/node_modules/gopd/index.js +2 -3
- package/node_modules/gopd/package.json +16 -10
- package/node_modules/gopd/test/index.js +2 -1
- package/node_modules/gopd/tsconfig.json +9 -0
- package/node_modules/has-symbols/CHANGELOG.md +16 -0
- package/node_modules/has-symbols/index.d.ts +3 -0
- package/node_modules/has-symbols/index.js +1 -0
- package/node_modules/has-symbols/package.json +19 -9
- package/node_modules/has-symbols/shams.d.ts +3 -0
- package/node_modules/has-symbols/shams.js +5 -2
- package/node_modules/has-symbols/test/shams/core-js.js +1 -0
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +1 -0
- package/node_modules/has-symbols/test/tests.js +4 -2
- package/node_modules/has-symbols/tsconfig.json +10 -0
- package/node_modules/path-to-regexp/index.js +13 -3
- package/node_modules/path-to-regexp/package.json +1 -1
- package/node_modules/psl/README.md +75 -31
- package/node_modules/psl/SECURITY.md +13 -0
- package/node_modules/psl/data/rules.js +9778 -0
- package/node_modules/psl/dist/psl.cjs +1 -0
- package/node_modules/psl/dist/psl.mjs +10008 -0
- package/node_modules/psl/dist/psl.umd.cjs +1 -0
- package/node_modules/psl/index.js +59 -81
- package/node_modules/psl/package.json +24 -15
- package/node_modules/psl/types/index.d.ts +52 -0
- package/node_modules/psl/types/test.ts +14 -0
- package/node_modules/psl/types/tsconfig.json +22 -0
- package/node_modules/psl/vite.config.js +20 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +1 -1
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +1 -1
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +20 -11
- package/node_modules/yaml/dist/schema/json/schema.js +1 -1
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +1 -1
- package/node_modules/yaml/dist/stringify/stringifyString.js +20 -11
- package/node_modules/yaml/package.json +1 -1
- package/package.json +1 -1
- package/node_modules/has-proto/CHANGELOG.md +0 -38
- package/node_modules/has-proto/README.md +0 -38
- package/node_modules/has-proto/index.d.ts +0 -3
- package/node_modules/has-proto/index.js +0 -15
- package/node_modules/has-proto/test/index.js +0 -19
- package/node_modules/has-proto/tsconfig.json +0 -49
- package/node_modules/psl/browserstack.yml +0 -73
- package/node_modules/psl/data/rules.json +0 -9779
- package/node_modules/psl/dist/psl.js +0 -10498
- package/node_modules/psl/dist/psl.min.js +0 -1
- package/node_modules/psl/eslint.config.js +0 -9
- package/node_modules/psl/local.log +0 -12
- package/node_modules/psl/log/usage.log +0 -20
- package/node_modules/psl/playwright.config.js +0 -31
- package/node_modules/psl/test-results/.last-run.json +0 -4
- /package/node_modules/{has-proto → dunder-proto}/.eslintrc +0 -0
|
@@ -1,69 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var Punycode = require('punycode/');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var internals = {};
|
|
9
|
-
|
|
1
|
+
import punycode from 'punycode/punycode.js';
|
|
2
|
+
import rules from './data/rules.js';
|
|
10
3
|
|
|
11
4
|
//
|
|
12
|
-
//
|
|
5
|
+
// Parse rules from file.
|
|
13
6
|
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
punySuffix: -1,
|
|
20
|
-
wildcard: rule.charAt(0) === '*',
|
|
21
|
-
exception: rule.charAt(0) === '!'
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
|
|
7
|
+
const rulesByPunySuffix = rules.reduce(
|
|
8
|
+
(map, rule) => {
|
|
9
|
+
const suffix = rule.replace(/^(\*\.|\!)/, '');
|
|
10
|
+
const punySuffix = punycode.toASCII(suffix);
|
|
11
|
+
const firstChar = rule.charAt(0);
|
|
25
12
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
internals.endsWith = function (str, suffix) {
|
|
13
|
+
if (map.has(punySuffix)) {
|
|
14
|
+
throw new Error(`Multiple rules found for ${rule} (${punySuffix})`);
|
|
15
|
+
}
|
|
30
16
|
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
map.set(punySuffix, {
|
|
18
|
+
rule,
|
|
19
|
+
suffix,
|
|
20
|
+
punySuffix,
|
|
21
|
+
wildcard: firstChar === '*',
|
|
22
|
+
exception: firstChar === '!'
|
|
23
|
+
});
|
|
33
24
|
|
|
25
|
+
return map;
|
|
26
|
+
},
|
|
27
|
+
new Map(),
|
|
28
|
+
);
|
|
34
29
|
|
|
35
30
|
//
|
|
36
31
|
// Find rule for a given domain.
|
|
37
32
|
//
|
|
38
|
-
|
|
33
|
+
const findRule = (domain) => {
|
|
34
|
+
const punyDomain = punycode.toASCII(domain);
|
|
35
|
+
const punyDomainChunks = punyDomain.split('.');
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
if (!internals.endsWith(punyDomain, '.' + rule.punySuffix) && punyDomain !== rule.punySuffix) {
|
|
47
|
-
return memo;
|
|
37
|
+
for (let i = 0; i < punyDomainChunks.length; i++) {
|
|
38
|
+
const suffix = punyDomainChunks.slice(i).join('.');
|
|
39
|
+
const matchingRules = rulesByPunySuffix.get(suffix);
|
|
40
|
+
if (matchingRules) {
|
|
41
|
+
return matchingRules;
|
|
48
42
|
}
|
|
49
|
-
|
|
50
|
-
// sub tlds always appear after their parents and we never find a shorter
|
|
51
|
-
// match.
|
|
52
|
-
//if (memo) {
|
|
53
|
-
// var memoSuffix = Punycode.toASCII(memo.suffix);
|
|
54
|
-
// if (memoSuffix.length >= punySuffix.length) {
|
|
55
|
-
// return memo;
|
|
56
|
-
// }
|
|
57
|
-
//}
|
|
58
|
-
return rule;
|
|
59
|
-
}, null);
|
|
60
|
-
};
|
|
43
|
+
}
|
|
61
44
|
|
|
45
|
+
return null;
|
|
46
|
+
};
|
|
62
47
|
|
|
63
48
|
//
|
|
64
49
|
// Error codes and messages.
|
|
65
50
|
//
|
|
66
|
-
|
|
51
|
+
export const errorCodes = {
|
|
67
52
|
DOMAIN_TOO_SHORT: 'Domain name too short.',
|
|
68
53
|
DOMAIN_TOO_LONG: 'Domain name too long. It should be no more than 255 chars.',
|
|
69
54
|
LABEL_STARTS_WITH_DASH: 'Domain name label can not start with a dash.',
|
|
@@ -73,7 +58,6 @@ exports.errorCodes = {
|
|
|
73
58
|
LABEL_INVALID_CHARS: 'Domain name label can only contain alphanumeric characters or dashes.'
|
|
74
59
|
};
|
|
75
60
|
|
|
76
|
-
|
|
77
61
|
//
|
|
78
62
|
// Validate domain name and throw if not valid.
|
|
79
63
|
//
|
|
@@ -93,10 +77,9 @@ exports.errorCodes = {
|
|
|
93
77
|
// * http://en.wikipedia.org/wiki/Domain_name
|
|
94
78
|
// * http://en.wikipedia.org/wiki/Hostname
|
|
95
79
|
//
|
|
96
|
-
|
|
97
|
-
|
|
80
|
+
const validate = (input) => {
|
|
98
81
|
// Before we can validate we need to take care of IDNs with unicode chars.
|
|
99
|
-
|
|
82
|
+
const ascii = punycode.toASCII(input);
|
|
100
83
|
|
|
101
84
|
if (ascii.length < 1) {
|
|
102
85
|
return 'DOMAIN_TOO_SHORT';
|
|
@@ -106,10 +89,10 @@ internals.validate = function (input) {
|
|
|
106
89
|
}
|
|
107
90
|
|
|
108
91
|
// Check each part's length and allowed chars.
|
|
109
|
-
|
|
110
|
-
|
|
92
|
+
const labels = ascii.split('.');
|
|
93
|
+
let label;
|
|
111
94
|
|
|
112
|
-
for (
|
|
95
|
+
for (let i = 0; i < labels.length; ++i) {
|
|
113
96
|
label = labels[i];
|
|
114
97
|
if (!label.length) {
|
|
115
98
|
return 'LABEL_TOO_SHORT';
|
|
@@ -123,29 +106,26 @@ internals.validate = function (input) {
|
|
|
123
106
|
if (label.charAt(label.length - 1) === '-') {
|
|
124
107
|
return 'LABEL_ENDS_WITH_DASH';
|
|
125
108
|
}
|
|
126
|
-
if (!/^[a-z0-9\-]+$/.test(label)) {
|
|
109
|
+
if (!/^[a-z0-9\-_]+$/.test(label)) {
|
|
127
110
|
return 'LABEL_INVALID_CHARS';
|
|
128
111
|
}
|
|
129
112
|
}
|
|
130
113
|
};
|
|
131
114
|
|
|
132
|
-
|
|
133
115
|
//
|
|
134
116
|
// Public API
|
|
135
117
|
//
|
|
136
118
|
|
|
137
|
-
|
|
138
119
|
//
|
|
139
120
|
// Parse domain.
|
|
140
121
|
//
|
|
141
|
-
|
|
142
|
-
|
|
122
|
+
export const parse = (input) => {
|
|
143
123
|
if (typeof input !== 'string') {
|
|
144
124
|
throw new TypeError('Domain name must be a string.');
|
|
145
125
|
}
|
|
146
126
|
|
|
147
127
|
// Force domain to lowercase.
|
|
148
|
-
|
|
128
|
+
let domain = input.slice(0).toLowerCase();
|
|
149
129
|
|
|
150
130
|
// Handle FQDN.
|
|
151
131
|
// TODO: Simply remove trailing dot?
|
|
@@ -154,18 +134,18 @@ exports.parse = function (input) {
|
|
|
154
134
|
}
|
|
155
135
|
|
|
156
136
|
// Validate and sanitise input.
|
|
157
|
-
|
|
137
|
+
const error = validate(domain);
|
|
158
138
|
if (error) {
|
|
159
139
|
return {
|
|
160
140
|
input: input,
|
|
161
141
|
error: {
|
|
162
|
-
message:
|
|
142
|
+
message: errorCodes[error],
|
|
163
143
|
code: error
|
|
164
144
|
}
|
|
165
145
|
};
|
|
166
146
|
}
|
|
167
147
|
|
|
168
|
-
|
|
148
|
+
const parsed = {
|
|
169
149
|
input: input,
|
|
170
150
|
tld: null,
|
|
171
151
|
sld: null,
|
|
@@ -174,28 +154,27 @@ exports.parse = function (input) {
|
|
|
174
154
|
listed: false
|
|
175
155
|
};
|
|
176
156
|
|
|
177
|
-
|
|
157
|
+
const domainParts = domain.split('.');
|
|
178
158
|
|
|
179
159
|
// Non-Internet TLD
|
|
180
160
|
if (domainParts[domainParts.length - 1] === 'local') {
|
|
181
161
|
return parsed;
|
|
182
162
|
}
|
|
183
163
|
|
|
184
|
-
|
|
185
|
-
|
|
164
|
+
const handlePunycode = () => {
|
|
186
165
|
if (!/xn--/.test(domain)) {
|
|
187
166
|
return parsed;
|
|
188
167
|
}
|
|
189
168
|
if (parsed.domain) {
|
|
190
|
-
parsed.domain =
|
|
169
|
+
parsed.domain = punycode.toASCII(parsed.domain);
|
|
191
170
|
}
|
|
192
171
|
if (parsed.subdomain) {
|
|
193
|
-
parsed.subdomain =
|
|
172
|
+
parsed.subdomain = punycode.toASCII(parsed.subdomain);
|
|
194
173
|
}
|
|
195
174
|
return parsed;
|
|
196
175
|
};
|
|
197
176
|
|
|
198
|
-
|
|
177
|
+
const rule = findRule(domain);
|
|
199
178
|
|
|
200
179
|
// Unlisted tld.
|
|
201
180
|
if (!rule) {
|
|
@@ -208,14 +187,15 @@ exports.parse = function (input) {
|
|
|
208
187
|
if (domainParts.length) {
|
|
209
188
|
parsed.subdomain = domainParts.pop();
|
|
210
189
|
}
|
|
190
|
+
|
|
211
191
|
return handlePunycode();
|
|
212
192
|
}
|
|
213
193
|
|
|
214
194
|
// At this point we know the public suffix is listed.
|
|
215
195
|
parsed.listed = true;
|
|
216
196
|
|
|
217
|
-
|
|
218
|
-
|
|
197
|
+
const tldParts = rule.suffix.split('.');
|
|
198
|
+
const privateParts = domainParts.slice(0, domainParts.length - tldParts.length);
|
|
219
199
|
|
|
220
200
|
if (rule.exception) {
|
|
221
201
|
privateParts.push(tldParts.shift());
|
|
@@ -246,24 +226,22 @@ exports.parse = function (input) {
|
|
|
246
226
|
return handlePunycode();
|
|
247
227
|
};
|
|
248
228
|
|
|
249
|
-
|
|
250
229
|
//
|
|
251
230
|
// Get domain.
|
|
252
231
|
//
|
|
253
|
-
|
|
254
|
-
|
|
232
|
+
export const get = (domain) => {
|
|
255
233
|
if (!domain) {
|
|
256
234
|
return null;
|
|
257
235
|
}
|
|
258
|
-
return
|
|
236
|
+
return parse(domain).domain || null;
|
|
259
237
|
};
|
|
260
238
|
|
|
261
|
-
|
|
262
239
|
//
|
|
263
240
|
// Check whether domain belongs to a known public suffix.
|
|
264
241
|
//
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
var parsed = exports.parse(domain);
|
|
242
|
+
export const isValid = (domain) => {
|
|
243
|
+
const parsed = parse(domain);
|
|
268
244
|
return Boolean(parsed.domain && parsed.listed);
|
|
269
245
|
};
|
|
246
|
+
|
|
247
|
+
export default { parse, get, isValid };
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "psl",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Domain name parser based on the Public Suffix List",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git@github.com:lupomontero/psl.git"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./dist/psl.cjs",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/psl.mjs",
|
|
14
|
+
"require": "./dist/psl.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"types": "types/index.d.ts",
|
|
10
18
|
"scripts": {
|
|
11
19
|
"lint": "eslint .",
|
|
12
20
|
"test": "mocha test/*.spec.js",
|
|
13
21
|
"test:browserstack": "browserstack-node-sdk playwright test",
|
|
14
22
|
"watch": "mocha test/*.spec.js --watch",
|
|
15
|
-
"
|
|
16
|
-
"build": "
|
|
17
|
-
"postbuild": "
|
|
18
|
-
"
|
|
23
|
+
"update-rules": "./scripts/update-rules.js",
|
|
24
|
+
"build": "vite build",
|
|
25
|
+
"postbuild": "ln -s ./psl.umd.cjs dist/psl.js && ln -s ./psl.umd.cjs dist/psl.min.js",
|
|
26
|
+
"benchmark": "node --experimental-vm-modules --no-warnings benchmark/suite.js",
|
|
19
27
|
"changelog": "git log $(git describe --tags --abbrev=0)..HEAD --oneline --format=\"%h %s (%an <%ae>)\""
|
|
20
28
|
},
|
|
21
29
|
"keywords": [
|
|
@@ -23,20 +31,21 @@
|
|
|
23
31
|
"publicsuffixlist"
|
|
24
32
|
],
|
|
25
33
|
"author": "Lupo Montero <lupomontero@gmail.com> (https://lupomontero.com/)",
|
|
34
|
+
"funding": "https://github.com/sponsors/lupomontero",
|
|
26
35
|
"license": "MIT",
|
|
27
36
|
"dependencies": {
|
|
28
37
|
"punycode": "^2.3.1"
|
|
29
38
|
},
|
|
30
39
|
"devDependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"eslint": "^9.
|
|
37
|
-
"JSONStream": "^1.3.5",
|
|
40
|
+
"@eslint/js": "^9.16.0",
|
|
41
|
+
"@playwright/test": "^1.49.0",
|
|
42
|
+
"@types/eslint__js": "^8.42.3",
|
|
43
|
+
"benchmark": "^2.1.4",
|
|
44
|
+
"browserstack-node-sdk": "^1.34.27",
|
|
45
|
+
"eslint": "^9.16.0",
|
|
38
46
|
"mocha": "^10.8.2",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
47
|
+
"typescript": "^5.7.2",
|
|
48
|
+
"typescript-eslint": "^8.16.0",
|
|
49
|
+
"vite": "^6.0.2"
|
|
41
50
|
}
|
|
42
51
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// TypeScript Version: 2.4
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Result returned when a given domain name was not parsable (not exported)
|
|
5
|
+
*/
|
|
6
|
+
export type ErrorResult<T extends keyof errorCodes> = {
|
|
7
|
+
input: string;
|
|
8
|
+
error: {
|
|
9
|
+
code: T;
|
|
10
|
+
message: errorCodes[T];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Error codes and descriptions for domain name parsing errors
|
|
16
|
+
*/
|
|
17
|
+
export const enum errorCodes {
|
|
18
|
+
DOMAIN_TOO_SHORT = 'Domain name too short',
|
|
19
|
+
DOMAIN_TOO_LONG = 'Domain name too long. It should be no more than 255 chars.',
|
|
20
|
+
LABEL_STARTS_WITH_DASH = 'Domain name label can not start with a dash.',
|
|
21
|
+
LABEL_ENDS_WITH_DASH = 'Domain name label can not end with a dash.',
|
|
22
|
+
LABEL_TOO_LONG = 'Domain name label should be at most 63 chars long.',
|
|
23
|
+
LABEL_TOO_SHORT = 'Domain name label should be at least 1 character long.',
|
|
24
|
+
LABEL_INVALID_CHARS = 'Domain name label can only contain alphanumeric characters or dashes.'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Export the browser global variable name additionally to the CJS/AMD exports below
|
|
28
|
+
export as namespace psl;
|
|
29
|
+
|
|
30
|
+
export type ParsedDomain = {
|
|
31
|
+
input: string;
|
|
32
|
+
tld: string | null;
|
|
33
|
+
sld: string | null;
|
|
34
|
+
domain: string | null;
|
|
35
|
+
subdomain: string | null;
|
|
36
|
+
listed: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Parse a domain name and return its components
|
|
41
|
+
*/
|
|
42
|
+
export function parse(input: string): ParsedDomain | ErrorResult<keyof errorCodes>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get the base domain for full domain name
|
|
46
|
+
*/
|
|
47
|
+
export function get(domain: string): string | null;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Check whether the given domain belongs to a known public suffix
|
|
51
|
+
*/
|
|
52
|
+
export function isValid(domain: string): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as psl from 'psl';
|
|
2
|
+
import type { ParsedDomain, ErrorResult, errorCodes } from './index.d.ts';
|
|
3
|
+
|
|
4
|
+
const x = (a: ParsedDomain | ErrorResult<keyof errorCodes>) => {
|
|
5
|
+
return a;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
console.log(x(psl.parse('')));
|
|
9
|
+
|
|
10
|
+
// $ExpectType string | null
|
|
11
|
+
console.log(psl.get('example.com'));
|
|
12
|
+
|
|
13
|
+
// $ExpectType boolean
|
|
14
|
+
console.log(psl.isValid('example.com'));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": [
|
|
6
|
+
"es5"
|
|
7
|
+
],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noEmit": false,
|
|
10
|
+
"noImplicitAny": true,
|
|
11
|
+
"noImplicitThis": true,
|
|
12
|
+
"strictNullChecks": true,
|
|
13
|
+
"strictFunctionTypes": true,
|
|
14
|
+
// Expose module under its CJS/AMD name
|
|
15
|
+
"baseUrl": ".",
|
|
16
|
+
"paths": {
|
|
17
|
+
"psl": [
|
|
18
|
+
"./index.d.ts"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
build: {
|
|
6
|
+
target: 'es2015',
|
|
7
|
+
lib: {
|
|
8
|
+
entry: resolve(__dirname, 'index.js'),
|
|
9
|
+
name: 'psl',
|
|
10
|
+
formats: ['es', 'cjs', 'umd'],
|
|
11
|
+
fileName: format => (
|
|
12
|
+
format === 'umd'
|
|
13
|
+
? 'psl.umd.cjs'
|
|
14
|
+
: format === 'cjs'
|
|
15
|
+
? 'psl.cjs'
|
|
16
|
+
: 'psl.mjs'
|
|
17
|
+
),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -95,7 +95,7 @@ const timestamp = {
|
|
|
95
95
|
}
|
|
96
96
|
return new Date(date);
|
|
97
97
|
},
|
|
98
|
-
stringify: ({ value }) => value.toISOString().replace(/(
|
|
98
|
+
stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, '')
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
export { floatTime, intTime, timestamp };
|
|
@@ -219,23 +219,32 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
|
219
219
|
start = start.replace(/\n+/g, `$&${indent}`);
|
|
220
220
|
}
|
|
221
221
|
const indentSize = indent ? '2' : '1'; // root is at -1
|
|
222
|
-
|
|
222
|
+
// Leading | or > is added later
|
|
223
|
+
let header = (startWithSpace ? indentSize : '') + chomp;
|
|
223
224
|
if (comment) {
|
|
224
225
|
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
|
225
226
|
if (onComment)
|
|
226
227
|
onComment();
|
|
227
228
|
}
|
|
228
|
-
if (literal) {
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
if (!literal) {
|
|
230
|
+
const foldedValue = value
|
|
231
|
+
.replace(/\n+/g, '\n$&')
|
|
232
|
+
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
233
|
+
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
234
|
+
.replace(/\n+/g, `$&${indent}`);
|
|
235
|
+
let literalFallback = false;
|
|
236
|
+
const foldOptions = getFoldOptions(ctx, true);
|
|
237
|
+
if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
|
|
238
|
+
foldOptions.onOverflow = () => {
|
|
239
|
+
literalFallback = true;
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
|
|
243
|
+
if (!literalFallback)
|
|
244
|
+
return `>${header}\n${indent}${body}`;
|
|
231
245
|
}
|
|
232
|
-
value = value
|
|
233
|
-
|
|
234
|
-
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
235
|
-
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
236
|
-
.replace(/\n+/g, `$&${indent}`);
|
|
237
|
-
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
|
|
238
|
-
return `${header}\n${indent}${body}`;
|
|
246
|
+
value = value.replace(/\n+/g, `$&${indent}`);
|
|
247
|
+
return `|${header}\n${indent}${start}${value}${end}`;
|
|
239
248
|
}
|
|
240
249
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
241
250
|
const { type, value } = item;
|
|
@@ -97,7 +97,7 @@ const timestamp = {
|
|
|
97
97
|
}
|
|
98
98
|
return new Date(date);
|
|
99
99
|
},
|
|
100
|
-
stringify: ({ value }) => value.toISOString().replace(/(
|
|
100
|
+
stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, '')
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
exports.floatTime = floatTime;
|
|
@@ -221,23 +221,32 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
|
221
221
|
start = start.replace(/\n+/g, `$&${indent}`);
|
|
222
222
|
}
|
|
223
223
|
const indentSize = indent ? '2' : '1'; // root is at -1
|
|
224
|
-
|
|
224
|
+
// Leading | or > is added later
|
|
225
|
+
let header = (startWithSpace ? indentSize : '') + chomp;
|
|
225
226
|
if (comment) {
|
|
226
227
|
header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
|
|
227
228
|
if (onComment)
|
|
228
229
|
onComment();
|
|
229
230
|
}
|
|
230
|
-
if (literal) {
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
if (!literal) {
|
|
232
|
+
const foldedValue = value
|
|
233
|
+
.replace(/\n+/g, '\n$&')
|
|
234
|
+
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
235
|
+
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
236
|
+
.replace(/\n+/g, `$&${indent}`);
|
|
237
|
+
let literalFallback = false;
|
|
238
|
+
const foldOptions = getFoldOptions(ctx, true);
|
|
239
|
+
if (blockQuote !== 'folded' && type !== Scalar.Scalar.BLOCK_FOLDED) {
|
|
240
|
+
foldOptions.onOverflow = () => {
|
|
241
|
+
literalFallback = true;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);
|
|
245
|
+
if (!literalFallback)
|
|
246
|
+
return `>${header}\n${indent}${body}`;
|
|
233
247
|
}
|
|
234
|
-
value = value
|
|
235
|
-
|
|
236
|
-
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
237
|
-
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
238
|
-
.replace(/\n+/g, `$&${indent}`);
|
|
239
|
-
const body = foldFlowLines.foldFlowLines(`${start}${value}${end}`, indent, foldFlowLines.FOLD_BLOCK, getFoldOptions(ctx, true));
|
|
240
|
-
return `${header}\n${indent}${body}`;
|
|
248
|
+
value = value.replace(/\n+/g, `$&${indent}`);
|
|
249
|
+
return `|${header}\n${indent}${start}${value}${end}`;
|
|
241
250
|
}
|
|
242
251
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
243
252
|
const { type, value } = item;
|
package/package.json
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [v1.0.3](https://github.com/inspect-js/has-proto/compare/v1.0.2...v1.0.3) - 2024-02-19
|
|
9
|
-
|
|
10
|
-
### Commits
|
|
11
|
-
|
|
12
|
-
- [types] add missing declaration file [`26ecade`](https://github.com/inspect-js/has-proto/commit/26ecade05d253bb5dc376945ee3186d1fbe334f8)
|
|
13
|
-
|
|
14
|
-
## [v1.0.2](https://github.com/inspect-js/has-proto/compare/v1.0.1...v1.0.2) - 2024-02-19
|
|
15
|
-
|
|
16
|
-
### Commits
|
|
17
|
-
|
|
18
|
-
- add types [`6435262`](https://github.com/inspect-js/has-proto/commit/64352626cf511c0276d5f4bb6be770a0bf0f8524)
|
|
19
|
-
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`f16a5e4`](https://github.com/inspect-js/has-proto/commit/f16a5e4121651e551271419f9d60fdd3561fd82c)
|
|
20
|
-
- [Refactor] tiny cleanup [`d1f1a4b`](https://github.com/inspect-js/has-proto/commit/d1f1a4bdc135f115a10f148ce302676224534702)
|
|
21
|
-
- [meta] add `sideEffects` flag [`e7ab1a6`](https://github.com/inspect-js/has-proto/commit/e7ab1a6f153b3e80dee68d1748b71e46767a0531)
|
|
22
|
-
|
|
23
|
-
## [v1.0.1](https://github.com/inspect-js/has-proto/compare/v1.0.0...v1.0.1) - 2022-12-21
|
|
24
|
-
|
|
25
|
-
### Commits
|
|
26
|
-
|
|
27
|
-
- [meta] correct URLs and description [`ef34483`](https://github.com/inspect-js/has-proto/commit/ef34483ca0d35680f271b6b96e35526151b25dfc)
|
|
28
|
-
- [patch] add an additional criteria [`e81959e`](https://github.com/inspect-js/has-proto/commit/e81959ed7c7a77fbf459f00cb4ef824f1099497f)
|
|
29
|
-
- [Dev Deps] update `aud` [`2bec2c4`](https://github.com/inspect-js/has-proto/commit/2bec2c47b072b122ff5443fba0263f6dc649531f)
|
|
30
|
-
|
|
31
|
-
## v1.0.0 - 2022-12-12
|
|
32
|
-
|
|
33
|
-
### Commits
|
|
34
|
-
|
|
35
|
-
- Initial implementation, tests, readme [`6886fea`](https://github.com/inspect-js/has-proto/commit/6886fea578f67daf69a7920b2eb7637ea6ebb0bc)
|
|
36
|
-
- Initial commit [`99129c8`](https://github.com/inspect-js/has-proto/commit/99129c8f42471ac89cb681ba9cb9d52a583eb94f)
|
|
37
|
-
- npm init [`2844ad8`](https://github.com/inspect-js/has-proto/commit/2844ad8e75b84d66a46765b3bab9d2e8ea692e10)
|
|
38
|
-
- Only apps should have lockfiles [`c65bc5e`](https://github.com/inspect-js/has-proto/commit/c65bc5e40b9004463f7336d47c67245fb139a36a)
|