step-node-agent 3.26.3 → 3.26.4

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.
@@ -30,29 +30,73 @@ Source: http://publicsuffix.org
30
30
 
31
31
  ## Installation
32
32
 
33
+ This module is available both for Node.js and the browser. See below for more
34
+ details.
35
+
33
36
  ### Node.js
34
37
 
35
38
  ```sh
36
- npm install --save psl
39
+ npm install psl
40
+ ```
41
+
42
+ #### ESM
43
+
44
+ From version `v1.11.0` you can now import `psl` as ESM.
45
+
46
+ ```js
47
+ import psl from 'psl';
48
+ ```
49
+
50
+ #### CommonJS
51
+
52
+ If your project still uses CommonJS on Node.js v12 or later (with support for
53
+ conditional exports), you can continue importing the module like in previous
54
+ versions.
55
+
56
+ ```js
57
+ const psl = require('psl');
58
+ ```
59
+
60
+ ⚠️ If you are using Node.js v10 or older (😰), you can still use the latest
61
+ version of this module, but you will need to import the bundled UMD.
62
+
63
+ ```js
64
+ var psl = require('psl/dist/psl.umd.cjs');
37
65
  ```
38
66
 
39
67
  ### Browser
40
68
 
41
- Download [psl.min.js](https://raw.githubusercontent.com/lupomontero/psl/main/dist/psl.min.js)
69
+ #### Using a bundler
70
+
71
+ If you are using a bundler to build your app, you should be able to `import`
72
+ and/or `require` the module just like in Node.js.
73
+
74
+ #### ESM (using a CDN)
75
+
76
+ In modern browsers you can also import the ESM directly from a `CDN`. For
77
+ example:
78
+
79
+ ```js
80
+ import psl from 'https://unpkg.com/psl@latest/dist/psl.mjs';
81
+ ```
82
+
83
+ #### UMD / CommonJS
84
+
85
+ Finally, you can still download [`dist/psl.umd.cjs`](https://raw.githubusercontent.com/lupomontero/psl/main/dist/psl.umd.cjs)
42
86
  and include it in a script tag.
43
87
 
44
88
  ```html
45
- <script src="psl.min.js"></script>
89
+ <script src="psl.umd.cjs"></script>
46
90
  ```
47
91
 
48
- This script is browserified and wrapped in a [umd](https://github.com/umdjs/umd)
92
+ This script is bundled and wrapped in a [umd](https://github.com/umdjs/umd)
49
93
  wrapper so you should be able to use it standalone or together with a module
50
94
  loader.
51
95
 
52
96
  The script is also available on most popular CDNs. For example:
53
97
 
54
- * https://cdnjs.cloudflare.com/ajax/libs/psl/1.9.0/psl.min.js
55
- * https://unpkg.com/psl@1.9.0/dist/psl.min.js
98
+ * https://cdnjs.cloudflare.com/ajax/libs/psl/latest/psl.min.js
99
+ * https://unpkg.com/psl@latest/dist/psl.min.js
56
100
 
57
101
  ## API
58
102
 
@@ -66,27 +110,38 @@ properties:
66
110
  * `domain`: The domain name is the `sld` + `tld`.
67
111
  * `subdomain`: Optional parts left of the domain.
68
112
 
69
- #### Example:
113
+ #### Examples
114
+
115
+ Parse domain without subdomain:
70
116
 
71
117
  ```js
72
- var psl = require('psl');
118
+ import psl from 'psl';
73
119
 
74
- // Parse domain without subdomain
75
- var parsed = psl.parse('google.com');
120
+ const parsed = psl.parse('google.com');
76
121
  console.log(parsed.tld); // 'com'
77
122
  console.log(parsed.sld); // 'google'
78
123
  console.log(parsed.domain); // 'google.com'
79
124
  console.log(parsed.subdomain); // null
125
+ ```
80
126
 
81
- // Parse domain with subdomain
82
- var parsed = psl.parse('www.google.com');
127
+ Parse domain with subdomain:
128
+
129
+ ```js
130
+ import psl from 'psl';
131
+
132
+ const parsed = psl.parse('www.google.com');
83
133
  console.log(parsed.tld); // 'com'
84
134
  console.log(parsed.sld); // 'google'
85
135
  console.log(parsed.domain); // 'google.com'
86
136
  console.log(parsed.subdomain); // 'www'
137
+ ```
138
+
139
+ Parse domain with nested subdomains:
140
+
141
+ ```js
142
+ import psl from 'psl';
87
143
 
88
- // Parse domain with nested subdomains
89
- var parsed = psl.parse('a.b.c.d.foo.com');
144
+ const parsed = psl.parse('a.b.c.d.foo.com');
90
145
  console.log(parsed.tld); // 'com'
91
146
  console.log(parsed.sld); // 'foo'
92
147
  console.log(parsed.domain); // 'foo.com'
@@ -97,10 +152,10 @@ console.log(parsed.subdomain); // 'a.b.c.d'
97
152
 
98
153
  Get domain name, `sld` + `tld`. Returns `null` if not valid.
99
154
 
100
- #### Example:
155
+ #### Examples
101
156
 
102
157
  ```js
103
- var psl = require('psl');
158
+ import psl from 'psl';
104
159
 
105
160
  // null input.
106
161
  psl.get(null); // null
@@ -153,36 +208,33 @@ whether the domain has a valid Public Suffix.
153
208
  #### Example
154
209
 
155
210
  ```js
156
- var psl = require('psl');
211
+ import psl from 'psl';
157
212
 
158
213
  psl.isValid('google.com'); // true
159
214
  psl.isValid('www.google.com'); // true
160
215
  psl.isValid('x.yz'); // false
161
216
  ```
162
217
 
163
-
164
218
  ## Testing and Building
165
219
 
166
- Test are written using [`mocha`](https://mochajs.org/) and can be
167
- run in two different environments: `node` and `phantomjs`.
220
+ There are tests both for Node.js and the browser (using [Playwright](https://playwright.dev)
221
+ and [BrowserStack](https://www.browserstack.com/)).
168
222
 
169
223
  ```sh
170
- # This will run `eslint`, `mocha` and `karma`.
224
+ # Run tests in node.
171
225
  npm test
226
+ # Run tests in browserstack.
227
+ npm run test:browserstack
172
228
 
173
- # Individual test environments
174
- # Run tests in node only.
175
- ./node_modules/.bin/mocha test
176
- # Run tests in phantomjs only.
177
- ./node_modules/.bin/karma start ./karma.conf.js --single-run
229
+ # Update rules from publicsuffix.org
230
+ npm run update-rules
178
231
 
179
- # Build data (parse raw list) and create dist files
232
+ # Build ESM, CJS and UMD and create dist files
180
233
  npm run build
181
234
  ```
182
235
 
183
236
  Feel free to fork if you see possible improvements!
184
237
 
185
-
186
238
  ## Acknowledgements
187
239
 
188
240
  * Mozilla Foundation's [Public Suffix List](https://publicsuffix.org/)
@@ -190,12 +242,11 @@ Feel free to fork if you see possible improvements!
190
242
  test data.
191
243
  * Inspired by [weppos/publicsuffix-ruby](https://github.com/weppos/publicsuffix-ruby)
192
244
 
193
-
194
245
  ## License
195
246
 
196
247
  The MIT License (MIT)
197
248
 
198
- Copyright (c) 2017 Lupo Montero <lupomontero@gmail.com>
249
+ Copyright (c) 2014-2024 Lupo Montero <lupomontero@gmail.com>
199
250
 
200
251
  Permission is hereby granted, free of charge, to any person obtaining a copy
201
252
  of this software and associated documentation files (the "Software"), to deal