step-node-agent 3.26.2 → 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.
@@ -1,17 +1,15 @@
1
- /*eslint no-var:0, prefer-arrow-callback: 0, object-shorthand: 0 */
2
- 'use strict';
1
+ import Punycode from 'punycode/punycode.js';
3
2
 
4
-
5
- var Punycode = require('punycode');
3
+ import rules from './data/rules.js';
6
4
 
7
5
 
8
6
  var internals = {};
9
7
 
10
8
 
11
9
  //
12
- // Read rules from file.
10
+ // Parse rules from file.
13
11
  //
14
- internals.rules = require('./data/rules.json').map(function (rule) {
12
+ internals.rules = rules.map(function (rule) {
15
13
 
16
14
  return {
17
15
  rule: rule,
@@ -24,7 +22,7 @@ internals.rules = require('./data/rules.json').map(function (rule) {
24
22
 
25
23
 
26
24
  //
27
- // Check is given string ends with `suffix`.
25
+ // Check if given string ends with `suffix`.
28
26
  //
29
27
  internals.endsWith = function (str, suffix) {
30
28
 
@@ -40,7 +38,7 @@ internals.findRule = function (domain) {
40
38
  var punyDomain = Punycode.toASCII(domain);
41
39
  return internals.rules.reduce(function (memo, rule) {
42
40
 
43
- if (rule.punySuffix === -1){
41
+ if (rule.punySuffix === -1) {
44
42
  rule.punySuffix = Punycode.toASCII(rule.suffix);
45
43
  }
46
44
  if (!internals.endsWith(punyDomain, '.' + rule.punySuffix) && punyDomain !== rule.punySuffix) {
@@ -63,7 +61,7 @@ internals.findRule = function (domain) {
63
61
  //
64
62
  // Error codes and messages.
65
63
  //
66
- exports.errorCodes = {
64
+ export const errorCodes = {
67
65
  DOMAIN_TOO_SHORT: 'Domain name too short.',
68
66
  DOMAIN_TOO_LONG: 'Domain name too long. It should be no more than 255 chars.',
69
67
  LABEL_STARTS_WITH_DASH: 'Domain name label can not start with a dash.',
@@ -138,7 +136,7 @@ internals.validate = function (input) {
138
136
  //
139
137
  // Parse domain.
140
138
  //
141
- exports.parse = function (input) {
139
+ export const parse = function (input) {
142
140
 
143
141
  if (typeof input !== 'string') {
144
142
  throw new TypeError('Domain name must be a string.');
@@ -159,7 +157,7 @@ exports.parse = function (input) {
159
157
  return {
160
158
  input: input,
161
159
  error: {
162
- message: exports.errorCodes[error],
160
+ message: errorCodes[error],
163
161
  code: error
164
162
  }
165
163
  };
@@ -237,7 +235,7 @@ exports.parse = function (input) {
237
235
  }
238
236
 
239
237
  parsed.sld = privateParts.pop();
240
- parsed.domain = [parsed.sld, parsed.tld].join('.');
238
+ parsed.domain = [parsed.sld, parsed.tld].join('.');
241
239
 
242
240
  if (privateParts.length) {
243
241
  parsed.subdomain = privateParts.join('.');
@@ -250,20 +248,22 @@ exports.parse = function (input) {
250
248
  //
251
249
  // Get domain.
252
250
  //
253
- exports.get = function (domain) {
251
+ export const get = function (domain) {
254
252
 
255
253
  if (!domain) {
256
254
  return null;
257
255
  }
258
- return exports.parse(domain).domain || null;
256
+ return parse(domain).domain || null;
259
257
  };
260
258
 
261
259
 
262
260
  //
263
261
  // Check whether domain belongs to a known public suffix.
264
262
  //
265
- exports.isValid = function (domain) {
263
+ export const isValid = function (domain) {
266
264
 
267
- var parsed = exports.parse(domain);
265
+ var parsed = parse(domain);
268
266
  return Boolean(parsed.domain && parsed.listed);
269
267
  };
268
+
269
+ export default { parse, get, isValid };
@@ -1,21 +1,28 @@
1
1
  {
2
2
  "name": "psl",
3
- "version": "1.9.0",
3
+ "version": "1.13.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
- "main": "index.js",
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
- "test:browserstack": "node test/browserstack.js",
14
- "watch": "mocha test --watch",
15
- "prebuild": "./scripts/update-rules.js",
16
- "build": "browserify ./index.js --standalone=psl > ./dist/psl.js",
17
- "postbuild": "cat ./dist/psl.js | uglifyjs -c -m > ./dist/psl.min.js",
18
- "commit-and-pr": "commit-and-pr",
21
+ "test:browserstack": "browserstack-node-sdk playwright test",
22
+ "watch": "mocha test/*.spec.js --watch",
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",
19
26
  "changelog": "git log $(git describe --tags --abbrev=0)..HEAD --oneline --format=\"%h %s (%an <%ae>)\""
20
27
  },
21
28
  "keywords": [
@@ -24,20 +31,18 @@
24
31
  ],
25
32
  "author": "Lupo Montero <lupomontero@gmail.com> (https://lupomontero.com/)",
26
33
  "license": "MIT",
34
+ "dependencies": {
35
+ "punycode": "^2.3.1"
36
+ },
27
37
  "devDependencies": {
28
- "browserify": "^17.0.0",
29
- "browserslist-browserstack": "^3.1.1",
30
- "browserstack-local": "^1.5.1",
31
- "chai": "^4.3.6",
32
- "commit-and-pr": "^1.0.4",
33
- "eslint": "^8.19.0",
34
- "JSONStream": "^1.3.5",
35
- "mocha": "^7.2.0",
36
- "porch": "^2.0.0",
37
- "request": "^2.88.2",
38
- "selenium-webdriver": "^4.3.0",
39
- "serve-handler": "^6.1.3",
40
- "uglify-js": "^3.16.2",
41
- "watchify": "^4.0.0"
38
+ "@eslint/js": "^9.15.0",
39
+ "@playwright/test": "^1.49.0",
40
+ "@types/eslint__js": "^8.42.3",
41
+ "browserstack-node-sdk": "^1.34.23",
42
+ "eslint": "^9.15.0",
43
+ "mocha": "^10.8.2",
44
+ "typescript": "^5.6.3",
45
+ "typescript-eslint": "^8.15.0",
46
+ "vite": "^5.4.11"
42
47
  }
43
48
  }
@@ -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
+ });
@@ -27,7 +27,7 @@ const jsonScalars = [
27
27
  identify: value => typeof value === 'boolean',
28
28
  default: true,
29
29
  tag: 'tag:yaml.org,2002:bool',
30
- test: /^true|false$/,
30
+ test: /^true$|^false$/,
31
31
  resolve: str => str === 'true',
32
32
  stringify: stringifyJSON
33
33
  },
@@ -95,7 +95,7 @@ const timestamp = {
95
95
  }
96
96
  return new Date(date);
97
97
  },
98
- stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
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
- let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
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
- value = value.replace(/\n+/g, `$&${indent}`);
230
- return `${header}\n${indent}${start}${value}${end}`;
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
- .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
- 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;
@@ -29,7 +29,7 @@ const jsonScalars = [
29
29
  identify: value => typeof value === 'boolean',
30
30
  default: true,
31
31
  tag: 'tag:yaml.org,2002:bool',
32
- test: /^true|false$/,
32
+ test: /^true$|^false$/,
33
33
  resolve: str => str === 'true',
34
34
  stringify: stringifyJSON
35
35
  },
@@ -97,7 +97,7 @@ const timestamp = {
97
97
  }
98
98
  return new Date(date);
99
99
  },
100
- stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
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
- let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
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
- value = value.replace(/\n+/g, `$&${indent}`);
232
- return `${header}\n${indent}${start}${value}${end}`;
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
- .replace(/\n+/g, '\n$&')
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;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "license": "ISC",
5
5
  "author": "Eemeli Aro <eemeli@gmail.com>",
6
6
  "repository": "github:eemeli/yaml",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "step-node-agent",
3
- "version": "3.26.2",
3
+ "version": "3.26.4",
4
4
  "description": "The official STEP Agent implementation for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {
File without changes